Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not resolve all files for configuration ':app: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\qianx\AppData\Local\Android\Sdk\platforms\android-34\core-for-system-modules.jar. > Error while executing process C:\Program Files\JAVA\graalvm-jdk-17.0.8+9.1\bin\jlink.exe with arguments {--module-path C:\Users\qianx\.gradle\caches\transforms-4\5e62b93dc0d115c44f205d6d31d9cc87-83258251-99a0-43f1-bd71-dab9e757a1aa\transformed\output\temp\jmod --add-modules java.base --output C:\Users\qianx\.gradle\caches\transforms-4\5e62b93dc0d115c44f205d6d31d9cc87-83258251-99a0-43f1-bd71-dab9e757a1aa\transformed\output\jdkImage --disable-plugin system-modules}
解决方案
这个问题直接搜容易找歪,需要看一些更细一点的错误原因。运行下面命令
1 2
cd ./android ./gradlew.bat installDebug --info
然后我们可以在输出中找到更详细的错误信息
1 2 3 4 5 6 7 8 9 10 11 12
????: Module jdk.internal.vm.ci not found java.lang.module.FindException: Module jdk.internal.vm.ci not found at java.base/java.lang.module.Resolver.findFail(Resolver.java:893) at java.base/java.lang.module.Resolver.resolve(Resolver.java:129) at java.base/java.lang.module.Configuration.resolve(Configuration.java:421) at java.base/java.lang.module.Configuration.resolve(Configuration.java:255) at jdk.jlink/jdk.tools.jlink.internal.Jlink$JlinkConfiguration.resolve(Jlink.java:217) at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImageProvider(JlinkTask.java:551) at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.createImage(JlinkTask.java:439) at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:291) at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:55) at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:33)