java - some dependencies cause error when building apk flutter - Stack Overflow

admin2025-04-17  2

when i try to include any of those 2

dependencies:
  shared_preferences: ^2.0.11
  google_fonts: ^6.2.1

it causes the to not be able to build to APK anymore,
returning something like this:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared_preferences_android:compileReleaseJavaWithJavac'.
> Could not resolve all files for configuration ':shared_preferences_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:\src\Flutter\platforms\android-34\core-for-system-modules.jar.
         > Error while executing process C:\Program Files\Android\Android Studio3\jbr\bin\jlink.exe with arguments {--module-path C:\Users\USER\.gradle\caches\transforms-3\c7f5d563e1877cd5931fe99b4d6b075f\transformed\output\temp\jmod --add-modules java.base --output C:\Users\USER\.gradle\caches\transforms-3\c7f5d563e1877cd5931fe99b4d6b075f\transformed\output\jdkImage --disable-plugin system-modules}

i tried , also tried to downgrade jdk from 17 to 11 ,same issue occur

转载请注明原文地址:http://anycun.com/QandA/1744825610a88143.html