1
votes

I recently upgraded both Dart and Flutter via Android Studio and different issues started creeping out. I eventually updated the packages particularly the Firebase packages because in the past this resolved my issue. This time around however, I am stuck and could not run my flutter project on the AVD.


From Flutter Doctor:

[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.14393], locale en-PH)
• Flutter version 1.22.3 at C:\Users\Lester\source\flutter
• Framework revision 8874f21e79 (2 months ago), 2020-10-29 14:14:35 -0700
• Engine revision a1440ca392
• Dart version 2.10.3

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:/Users/Lester/AppData/Local/Android/Sdk
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:/Users/Lester/AppData/Local/Android/Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin installed
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)

• No issues found!


From Flutter run -v:

[+6890 ms] FAILURE: Build failed with an exception.
[ +110 ms] * What went wrong:
[ +1 ms] Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
[ +1 ms] > Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
[ ] > Problems reading data from Binary store in C:\Users\Lester\AppData\Local \Temp\gradle4590115280405278581.bin offset 165777 exists? true
[ +2 ms] * Try:
[ ] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[ ] * Get more help at https://help.gradle.org
[ ] BUILD FAILED in 15s
[ +2 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. [ +1 ms] Use '--warning-mode all' to show the individual deprecation warnings.

[ +308 ms] Running Gradle task 'assembleDebug'... (completed in 16.8s)
[+3291 ms] Exception: Gradle task assembleDebug failed with exit code 1

       #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)  
       #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:607:7)  
       <asynchronous suspension>  
       #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner  /flutter_command.dart:977:18)  
       #3      _rootRunUnary (dart:async/zone.dart:1198:47)  
       #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)  
       #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)  
       #6      Future._propagateToListeners.handleValueCallback   (dart:async/future_impl.dart:696:45)  
       #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)  
       #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)  
       #9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)  
       #10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)  
       #11     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)  
       #12     _rootRunUnary (dart:async/zone.dart:1198:47)  
       #13     _CustomZone.runUnary (dart:async/zone.dart:1100:19)  
       #14     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)  
       #15     Future._propagateToListeners.handleValueCallback   (dart:async/future_impl.dart:696:45)  
       #16     Future._propagateToListeners (dart:async/future_impl.dart:725:32)  
       #17     Future._completeWithValue (dart:async/future_impl.dart:529:5)  
       #18     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)  
       #19     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)  
       #20     AndroidDevice.isLocalEmulator (package:flutter_tools/src/android  /android_device.dart)  
       #21     _rootRunUnary (dart:async/zone.dart:1198:47)  
       #22     _CustomZone.runUnary (dart:async/zone.dart:1100:19)  
       #23     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)  
       #24     Future._propagateToListeners.handleValueCallback   (dart:async/future_impl.dart:696:45)  

       #25     Future._propagateToListeners (dart:async/future_impl.dart:725:32)  
       #26     Future._completeWithValue (dart:async/future_impl.dart:529:5)  
       #27     Future._asyncCompleteWithValue.<anonymous closure>   (dart:async/future_impl.dart:567:7)  
       #28     _rootRun (dart:async/zone.dart:1190:13)  
       #29     _CustomZone.run (dart:async/zone.dart:1093:19)  
       #30     _CustomZone.runGuarded (dart:async/zone.dart:997:7)  
       #31     _CustomZone.bindCallbackGuarded.<anonymous closure>   (dart:async/zone.dart:1037:23)  
       #32     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)  
       #33     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)  
       #34     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)  
       #35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)  

From pubspec.yaml:

version: 1.0.0+1

environment:  
  sdk: ">=2.7.0 <3.0.0"  

dependencies:  
  flutter:
    sdk: flutter  


  cupertino_icons: ^0.1.3  
  flutter_svg: ^0.18.1  
  progress_dialog: ^1.2.4  
  firebase_core: ^0.6.0  
  firebase_auth: ^0.19.0+1  
  cloud_firestore: ^0.15.0  
  google_sign_in: ^4.5.9  
  websafe_svg: ^1.1.4  
  firebase_storage: ^6.0.0  
  http: ^0.12.2  
  passwordfield: ^0.0.82  
  sqflite: ^1.3.1+1  
  path_provider: ^1.6.14  
  flutter_counter: ^1.0.3  
  flushbar: ^1.10.4  
  google_fonts: ^1.1.0  
  webview_flutter: ^0.3.24  
  flutter_custom_clippers: ^1.1.2  
  badges: ^1.1.3  
  video_player: ^1.0.0   

Thanks in advance.

4

4 Answers

0
votes

I think because the version of Gradle you are using has been deprecated by android causing this error. So, change the Gradle version to latest release , clean your all builds using flutter clean command and then try to run project again. Let me know if it solves your problem or not.

0
votes

Had to reinstall Android Studio, install everything else and recreate the project.

0
votes

Go to [your_flutter_project]>android>app>build.gradle.

Open build.gradle and change compileSdkVerison and targetSdkVersion to an earlier version. (version 29 worked for me).

Make sure both of them are have been changed to the same sdk version. and add the dependency to the dependencies section

    implementation 'com.google.firebase:firebase-iid:21.0.1'
0
votes

I know this is coming late but for me, I had to upgrade the firebase dependency imported in my "android/app/build.gradle", then I updated my minSdkVersion from 16 to 20. Sync your project, this might help