任务“:webview_flutter_android:compileDebugJavaWithJavac”执行失败。安装 google_mobile_ads

问题描述 投票:0回答:1

我给出了这个错误:

'Execution failed for task:webview_flutter_android:compileDebugJavaWithJavac'

在我的 Flutter 应用程序中安装 google_mobile_ads 包时。

当我运行 flutter pub add

google_mobile_ads
然后尝试在 Android 模拟器中运行该应用程序时,出现此错误。

* What went wrong:
Execution failed for task ':webview_flutter_android:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':webview_flutter_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: /Users/username/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/username/.gradle/caches/transforms-3/d9e926982c2c139ff9125eb7b6be4144/transformed/output/temp/jmod --add-modules java.base --output /Users/username/.gradle/caches/transforms-3/d9e926982c2c139ff9125eb7b6be4144/transformed/output/jdkImage --disable-plugin system-modules}

我不知道为什么会出现这个错误,因为我安装了java。

感谢您的帮助!

android flutter admob
1个回答
0
投票

问题是我没有在flutter中配置

jdk-dir

flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-20.jdk/Contents/Home
© www.soinside.com 2019 - 2024. All rights reserved.