skip to Main Content

After i set up my flutter project with firebase. I was unable to run my app.
I tried rebuilding the app with flutter clean and also tried changing the various java versions, currently at java v17. tried

./gradlew clean
./gradlew build
The build was successful with gradle.
But again when I ran it showed the same issue.

Launching libmain.dart on Pixel 8 Pro in debug mode...
Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':path_provider_android:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':path_provider_android:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: C:UsersnishaAppDataLocalAndroidsdkplatformsandroid-34core-for-system-modules.jar.
         > Error while executing process C:Program FilesAndroidAndroid Studiojbrbinjlink.exe with arguments {--module-path C:Usersnisha.gradlecachestransforms-31761d3d44a592c784df1715afe57f9ctransformedoutputtempjmod --add-modules java.base --output C:Usersnisha.gradlecachestransforms-31761d3d44a592c784df1715afe57f9ctransformedoutputjdkImage --disable-plugin system-modules}

* 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 2m 12s
Running Gradle task 'assembleDebug'...                            133.6s
Error: Gradle task assembleDebug failed with exit code 1

please help me out. How do I fix this? What’s causing this issue?

3

Answers


  1. Useful links when you connect your project with firebase:
    This link has step by step what you need to do CLI

    1. npm install -g firebase-tools
    2. dart pub global activate flutterfire_cli
    3. flutterfire configure
    Login or Signup to reply.
  2. These warnings

    warning: [options] source value 8 is obsolete and will be removed in a future release
    warning: [options] target value 8 is obsolete and will be removed in a future release
    

    And also error in androidJdkImage shows that, despite you claim you use java v17, actually java 21 used.
    You have couple options:

    1. force java 17 for flutter. Despite you’re using java 17 (I believe that JAVA_HOME points to it, right?), flutter uses, by default, Java from most recent Android Studio, if it exists. That’s may be the key to your problem and this strange behaviour.

    You can force java 17 with this command:

    flutter config --jdk-dir="path_to_Java_17_home"
    
    1. You actually can adapt your android project to Java 21 by updating AGP (android Gradle Plugin) in your settings.gradle to newer version. Anything starting 8.3.2 should work.

    Of course, after either of these options, make flutter clean and flutter pub get.

    Login or Signup to reply.
  3. I have the same problem. They’ve done detailed experiments here. You can examine it from this link.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search