javaandroidfluttergradlegoogle-signin

':google_sign_in_android:compileDebugJavaWithJavac'


I am working on a student project with Flutter version 3.24.3. Java version 22.0.1. I wanted to add Authentication with google. And when i added google_sign_in: ^6.2.1 to my pubspec.yaml i started getting getting this EROOR:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':google_sign_in_android:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':google_sign_in_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:\Users\User\AppData\Local\Android\sdk\platforms\android-34\core-for-system-modules.jar.
         > Error while executing process C:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path C:\Users\User\.gradle\caches\transforms-3\01761d3d44a592c784df1715afe57f9c\transformed\output\temp\jmod --add-modules java.base --output C:\Users\User\.gradle\caches\transforms-3\01761d3d44a592c784df1715afe57f9c\transformed\output\jdkImage --disable-plugin system-modules}

I tried to install different java versions, reinstall android-34, update android studio,other flutter version, other google_sign_in version. But nothing work


Solution

  • The same happened when I updated Android Studio to the latest version this week. I managed to resolve the issue with the help of a different thread: https://stackoverflow.com/a/79068663.

    After updating the com.android.application plugin to version 8.3.2 in the android/settings.gradle file and the gradle distributionUrl to v8.5 in the gradle-wrapper.properties file, it worked fine for me again.