Status Update
Comments
du...@google.com <du...@google.com>
ga...@google.com <ga...@google.com>
bi...@google.com <bi...@google.com>
bi...@google.com <bi...@google.com> #2
sg...@google.com <sg...@google.com> #3
I get the same error on a freshly downloaded 2020.3.1.4 extracted into /usr/local/google/home/sgjesse/android-studio/2020.3.1.4
:
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: /usr/local/google/home/sgjesse/Android/Sdk/platforms/android-30/core-for-system-modules.jar.
> jlink executable /usr/local/google/home/sgjesse/android-studio/2020.3.1.4/jre/bin/jlink does not exist.
I don't see and jlink
executable in /usr/local/google/home/sgjesse/android-studio/2020.3.1.4/jre/bin
:
ls /usr/local/google/home/sgjesse/android-studio/2020.3.1.4/jre/bin
jaotc javac jdb jhsdb jrunscript pack200 rmiregistry unpack200
java javadoc jfr jjs keytool rmid serialver
je...@google.com <je...@google.com> #4
seems like we require JDK binaries while Android Studio points us to a JRE.
is there a /usr/local/google/home/sgjesse/android-studio/2020.3.1.4/bin
folder in your installation ?
xf...@gmail.com <xf...@gmail.com> #5
ls /Applications/Android\ Studio\ Preview.app/Contents/jre/jdk/Contents/Home/bin
jaotc javadoc jhsdb keytool rmiregistry
java jdb jjs pack200 serialver
javac jfr jrunscript rmid unpack200
sg...@google.com <sg...@google.com> #6
Modifying the field File->Project Structure->SDK Location->JRE Location to point to a full JDK 11 (which includes bin/jlink
) fixes the issue.
For building directly with gradlew
a JDK 11 JDK has to be located either through org.gradle.java.home
in gradle.properties
, the JAVA_HOME
environment variable or the java
command first in the PATH
(in that order of precedence).
ga...@google.com <ga...@google.com> #7
Raluca, it seems that our prebuilts/studio/jdk/jdk11-runtime
is missing jlink
. Is this by design?
ga...@google.com <ga...@google.com>
bi...@google.com <bi...@google.com> #8
[Deleted User] <[Deleted User]> #9
Is this fixed?
b9...@gmail.com <b9...@gmail.com> #10
[Deleted User] <[Deleted User]> #11
Seeing the same issue in alpha11.
ga...@google.com <ga...@google.com> #12
Setting this a blocking the next canary, as it impacts usage of java 11 language features in 7.0.
Until it is fixed, please use the workaround from #6.
bi...@google.com <bi...@google.com> #13
For reporters who still see this issue, could you clarify which OS are you working on? Thanks!
xf...@gmail.com <xf...@gmail.com> #14
ch...@google.com <ch...@google.com> #16
I hit the same issue in Flamingo with the following in build.gradle.kts
(from
plugins.withType<JavaBasePlugin>().configureEach {
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
}
The workaround in
org.gradle.java.installations.paths=/path/to/jdk11,/path/to/jdk17
bi...@google.com <bi...@google.com> #17
re @16, does it work with Arctic Fox Canary 14?
ra...@google.com <ra...@google.com> #18
re: jlink
in our 17 runtime as well.
sg...@google.com <sg...@google.com> #19
From debugging the issue with Christoffer yesterday I think the issue is that explicitly setting the toolchain to JDK-11 (that Tivi use, jlink
. Setting org.gradle.java.installations.paths
explicitly to both a JDK-11 and a JDK-17 solved the issue.
The main issue here is that this is quite difficult to figure out, and the Gradle documentation spends a lot of time on its automatic discovery and automatic download leaving the explanation of the explicit configuration to the very end. If the use of explicit toolchain are commonly used maybe Studio should ship with multiple JDKs and not depend on local system configuration of the most commonly uses JDKs.
bi...@google.com <bi...@google.com> #20
Setting org.gradle.java.installations.paths
and shipping multiple JDKs would definitly helps Gradle to find the right JDK, but it seems we cannot guarantee the right one would be picked because Gradle does not prioritize custom toolchains over auto-detected toolchains. Maybe we can start having a better error message in the transform if the users is using a JRE instead of JDK or the JDK doesn't have the jlink.
sg...@google.com <sg...@google.com> #21
Yes you are right, we actually also added org.gradle.java.installations.auto-detect=false
, which was not mentioned in
co...@gmail.com <co...@gmail.com> #22
Everything worked after I installed JDK corretto-11 and added the following line to gradle.properties
org.gradle.java.installations.auto-download=true
pa...@gmail.com <pa...@gmail.com> #23
For posterity, because this ranks high on Google, even though the problem might not be exactly the same.
I got the same error on AGP 8.2.1. Here are some quick learnings:
gradlew :javaToolchains
is godsent when it comes to diagnosing these issues.- JDK 8 doesn't have
jlink
, becausejlink
is a tool for the JMS (Java Module System) introduced in Java 9. - Make sure you have
"org.gradle.toolchains.foojay-resolver-convention"
or other provider for Gradle set up. - Make sure
android.compileOptions.sourceCompatibility <= java.toolchain.languageVersion
, otherwise the error in #1 could come up.
Description
AI-202.7319.50.2031.7019041, JRE 11.0.8+10-b944.6842174x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.16, screens 2048x1152; Retina
AS: Arctic Fox | 2020.3.1 Canary 3; Kotlin plugin: 1.4.21-release-Studio4.2-1; Android Gradle Plugin: 7.0.0-alpha03; Gradle: 6.8; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)
IMPORTANT: Please read
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: /Library/Android/sdk/platforms/android-30/core-for-system-modules.jar.
> jlink executable /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents/Home/bin/jlink does not exist.