我正在开发一个 Flutter 项目,最近将我的 Android Studio、Java 版本以及 gradle-wrapper.properties 文件中的 gradle 版本升级到最新
在 gradle-wrapper.properties 文件中:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
构建应用程序时的错误日志:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus: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: /Users/..../Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
> Error while executing process /Users/..../Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/malwinder/.gradle/caches/8.10.2/transforms/057cd3d70c61a40076a3bbfe497a8e16-0d4425f6-230d-4e42-a5da-d5def5f24a35/transformed/output/temp/jmod --add-modules java.base --output /Users/..../.gradle/caches/8.10.2/transforms/057cd3d70c61a40076a3bbfe497a8e16-0d4425f6-230d-4e42-a5da-d5def5f24a35/transformed/output/jdkImage --disable-plugin system-modules}
Android Studio:
Android Studio Ladybug | 2024.2.1
Build #AI-242.21829.142.2421.12409432, built on September 25, 2024
Runtime version: 21.0.3+-79915917-b509.11 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 8
Metal Rendering is ON
Registry:
ide.balloon.shadow.size=0
debugger.new.tool.window.layout=true
ide.new.editor.tabs.vertical.borders=true
ide.animate.toolwindows=true
ide.experimental.ui=true
ide.editor.tab.selection.animation=true
i18n.locale=
Non-Bundled Plugins:
com.chylex.intellij.inspectionlens (1.4.1)
com.jetbrains.gerryPurpleTheme (2024.1.0920)
com.zll.format (2.2)
IdeaVIM (2.16.0)
dev.willebrands.intellij.sloppyfocus (0.9.0)
Dart (242.21829.3)
PlantUML integration (7.11.2-IJ2023.2)
com.bloc.intellij_generator_plugin (4.0.2)
com.flutter_create_stateful_widget (1.5)
andrasferenczi.dart-data-plugin (0.2.0)
com.markskelton.one-dark-theme (5.12.0)
com.ankit.mahadik.json.dart.class (2.16)
com.intellij.marketplace (242.21829.233)
com.localizely.flutter-intl (1.18.5-2023.2)
Key Promoter X (2024.2.0)
com.herbert.george.dart.extensions (0.0.1+3)
com.jiajun.flutter_add_image (1.7)
com.shuzijun.markdown-editor (2.0.5)
com.herbert.george.flutter-snippets (2.0.0-stable-1)
com.eggnstone.jetbrainsplugins.DartFormat (2.0.20)
Docker (242.21829.162)
izhangzhihao.rainbow.brackets (2024.2.6-241)
cn.yiiguxing.plugin.translate (3.6.6)
pl.pszklarska.pubversionchecker (1.3.5)
com.chrisrm.idea.MaterialThemeUI (9.5.0)
com.developerphil.adbidea (1.6.18)
com.github.kikimanjaro.stickyscroll (0.0.2)
com.github.copilot (1.5.24.6927-nightly)
org.intellij.qodana (242.21829.57)
com.mallowigi (97.0.0)
mobi.hsz.idea.gitignore (4.5.3)
io.flutter (81.1.3)
com.crzsc.FlutterAssetsGenerator (2.4.2)
de.mariushoefler.flutter_enhancement_suite (1.7.1)
com.ruiyu.ruiyu (5.2.1)
运行 MacOS Sequoia(15.0 版)
我认为这个问题与https://pub.dev/packages/connectivity_plus包
有关更多详情:https://github.com/fluttercommunity/plus_plugins/issues/3299
使用以下方法修复了问题:
id "com.android.application" version "8.7.0" apply false
在插件块中 android/settings.gradle