精华 Flutter shared_preferences 提示 failed for task ':shared_preferences_android:compileDebugJavaWithJavac

发布于 1周前 作者 itying888 最后一次编辑是 5天前 来自 Flutter

Flutter集成shared_preferences 提示 failed for task ':shared_preferences_android:compileDebugJavaWithJavac

Could not resolve all files for configuration ‘:shared_preferences_android:androidJdkImage’.

详情如下:

flutter run

AILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared_preferences_android:compileDebugJavaWithJavac'.
> 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:\Users\55402\AppData\Local\Android\sdk\platforms\android-34\core-for-system-modules.jar.
         > Error while executing process C:\Program Files\Android\Android Studio1\jbr\bin\jlink.exe with arguments {--module-path C:\Users\55402\.gradle\caches\8.9\transforms\f79a96d989e471940ddc8a7dcb0bd809-c824c3f1-b179-4826-8ecc-1af52c400430\transformed\output\temp\jmod --add-modules java.base --output C:\Users\55402\.gradle\caches\8.9\transforms\f79a96d989e471940ddc8a7dcb0bd809-c824c3f1-b179-4826-8ecc-1af52c400430\transformed\output\jdkImage --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 1m 59s
Running Gradle task 'assembleDebug'...                            120.1s
Error: Gradle task assembleDebug failed with exit code 1

1 回复

Flutter集成shared_preferences 提示 failed for task ':shared_preferences_android:compileDebugJavaWithJavac

Could not resolve all files for configuration ‘:shared_preferences_android:androidJdkImage’.的解决方案如下:

1、在Android Studio中,尝试使用“Build”菜单中的“Clean Project”和“Rebuild Project”选项。 2、也可以尝试在命令行中运行flutter clean和flutter pub get,然后再次构建项目。 3、重新运行

如果上面方法还没法解决的话 1、升级gradel Android Studio中点击file->syanc project width gradle File 按照提示升级 Gradle(如果没有提示忽略) 2、升级AGP a-2_20241130093958.png a_20241130093056.png

上面方法还是没法解决的话联系在线客服

https://www.itying.com/goods-1176.html 这个教程右侧有在线客服的

如果出不来升级AGP 1、flutter clean 2、 Android Studio中点击file->syanc project width gradle File 3、这个时候就会有提示升级AGP

回到顶部