Status Update
Comments
cl...@google.com <cl...@google.com>
ga...@gmail.com <ga...@gmail.com> #2
ga...@google.com <ga...@google.com>
bi...@google.com <bi...@google.com> #3
Thanks for the report!
IIUC, because it doesn't show much details on how this process fails, you did two manual invocation and got different error messages
One is mentioned in
Error: Module [jdk.internal.vm.ci](http://jdk.internal.vm.ci/) not found
java.lang.module.FindException: Module [jdk.internal.vm.ci](http://jdk.internal.vm.ci/) not found
The other is mentioned in
Error: jdk.tools.jlink.plugin.PluginException: ModuleTarget is malformed: platformString missing delimiter: android
In
Can AGP provides to modify jlink option to use Other JDKs?
Can you clarify more on this points? I assume you want to customize the command for that process. When you invoking the process manually, did you try to do some "customization"(e.g. adding jdk.internal.vm.ci
)
Another question is: Going back to the observation of two "root causes", if everything is the same, I assume you would get one "root cause", what is the difference between your manual invocations?
ga...@linecorp.com <ga...@linecorp.com> #4
Thanks for interest.
Can AGP provides to modify jlink option to use Other JDKs?
This suggestion was made before I knew the exact cause,
And after checking it out, I realized that it can't be fixed by adding an option to the jlink.
My understanding is that OpenJDK 21 and GraalVM 22.3 and later are not suitable for building on the Android platform,
And depending on Oracle's development direction, it may be difficult to develop for Android with these tools.
ga...@linecorp.com <ga...@linecorp.com> #5
As I understand, IntelliJ IDEA will ship OpenJDK 21 after it goes gold.
Then Android Studio will follow Jetbrains changes.
And this issue will be critical on Android Development.
I'm guessing it is hard to to ask Oracle to support the jlink/jmod tool for Android platform
, because Android is not official platform in JDK.
So, I wanna to ask whether JdkImageTransformDelegate
can be implemented without jlink invocation from OpenJDK?
bi...@google.com <bi...@google.com>
ga...@linecorp.com <ga...@linecorp.com> #6
I tried to convert JdkImageTransformDelegate
logic to plain shell script.
And tried to set --target-platform
parameter to LINUX-X64
which is my current host platform.
Then it works well.
diff --git a/standalone/test.sh b/standalone/test.sh
index 7ab7278..447f055 100755
--- a/standalone/test.sh
+++ b/standalone/test.sh
@@ -56,7 +56,7 @@ createJmodFromModularJar() {
"${JMOD}" \
create \
--module-version ${jlinkVersion} \
- --target-platform android \
+ --target-platform LINUX-X64 \
--class-path "${moduleJar}" \
"${jmodFile}"
}
$ env JAVA_HOME=/usr/lib/jvm/jdk-21 ./test.sh
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment (build 21+35-2513)
OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
Compiling module-info.java
Create java.base.jmod for Android Platform
Perform jlink to generate image
java.base file:///home/ganadist/src/build/AndroidStudioProjects/MyApplication3/standalone/./jmod/java.base.jmod
list of jmod
java.base@21
exports android.icu.lang
exports android.icu.math
exports android.icu.number
AFAIK, Java toolchain and core-for-system-modules.jar
are used to generate intermediates output, and used on build system(Host) only.
So "--target-platform HOSTOS-HOSTARCH" might be more suitable than "--target-platform android" in current situation.
Also, HOSTOS and HOSTARCH should be registered as Task Input
to avoid contamination of the gradle remote cache.
bi...@google.com <bi...@google.com> #8
Yes, the target platform needs to be "OS-ARCH" which is why "android" is not an accept format.
My understanding is that we create jmod or the final java.base module to compile sources, which means we only care about the byte code being generated. Therefore, I think we don't care about the target platform. If we have to specify, LINUX-OTHER might be the best one.
cc...@google.com <cc...@google.com> #9
I don't think we care what the value is, as long as javac will compile correctly against the resulting system modules. LINUX-OTHER
SGTM.
ga...@linecorp.com <ga...@linecorp.com> #10
I found
And confirmed that this issue was resolved at Android Gradle Plugin 8.3.0-alpha03.
Thank you very much for resolving this.
And, is it possible that cherry-pick this change into AGP 8.2.0-beta series?
Because Java 21 will be released at this month, and I'm guessing AGP 8.2 will be out after JDK21 release.
bi...@google.com <bi...@google.com> #11
Thanks for trying it out and we are glad to see it works!
We don't plan to cherry-pick to 8.2 because we normally only do that for regression or critical bugs.
xa...@google.com <xa...@google.com> #12
Bingran, can you cherry-pick your fix to the hedgehog-dev branch? we're going to take this fix for Patch 1.
ey...@gmail.com <ey...@gmail.com> #13
So this was fixed three months ago, while Hedgehog was still in beta, and was a one liner, and couldn't be backported? What's the point of having beta and rc builds if reported bugs don't get fixed in them? Makes me question why I spend my time using the betas and rcs and report issues based on them.
xa...@google.com <xa...@google.com> #14
Yes, we dropped the ball, we should have cherry-picked this earlier.
bi...@google.com <bi...@google.com> #15
cherry-pick to hedgehog is landed I7f9faedeaeea0ae802d9a33930df116152ff2748
an...@google.com <an...@google.com> #16
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Hedgehog | 2023.1.1 Patch 1
- Android Gradle Plugin 8.2.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
th...@gmail.com <th...@gmail.com> #17
Ignore this post. I initially only updated AS and missed to update AGP. Works for me with AGP 8.2.1 and openjdk 21.0.1.
so...@google.com <so...@google.com> #18
Comment added by automation: A postmortem has been automatically requested for this issue. Please author a postmortem on IRM. See go/android-postmortem-guidance for more context and details, including how to handle the case when this issue does not need a postmortem. If you have any questions not answered by go/android-postmortem-guidance, please email android-hygiene-tpm@, instead of reassigning the fixed bug. Thank you.
ma...@gmail.com <ma...@gmail.com> #19
Running Gradle task 'assembleDebug'...
FAILURE: 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\manor\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\manor\.gradle\caches\transforms-3\f41347c990b0e680f05f596924e70932\transformed\output\temp\jmod --add-modules java.base --output C:\Users\manor\.gradle\caches\transforms-3\f41347c990b0e680f05f596924e70932\transformed\output\jdkImage --disable-plugin system-modules}
* Try:
BUILD FAILED in 13s
┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────────┐
│ [!] This is likely due to a known bug in Android Gradle Plugin (AGP) versions less than 8.2.1, │
│ when │
│ 1. setting a value for SourceCompatibility and │
│ 2. using Java 21 or above. │
│ To fix this error, please upgrade your AGP version to at least 8.2.1. The version of AGP that │
│ your project uses is likely defined in: │
│ D:\filmy_fun\android\settings.gradle, │
│ in the 'plugins' closure (by the number following "com.android.application"). │
│ Alternatively, if your project was created with an older version of the templates, it is likely │
│ in the buildscript.dependencies closure of the top-level build.gradle: │
│ D:\filmy_fun\android\build.gradle, │
│ as the number following "com.android.tools.build:gradle:". │
│ │
│ For more information, see: │
│
│
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1
te...@gmail.com <te...@gmail.com> #20
any Solution of this??
fl...@gmail.com <fl...@gmail.com> #21
xa...@google.com <xa...@google.com> #22
If you are coming here via a link coming from Flutter, the solution is in the flutter output:
To fix this error, please upgrade your AGP version to at least 8.2.1
Description
DESCRIBE THE ISSUE IN DETAIL:
This is similar issue with b/294120922 , but it has different cause.
STEPS TO REPRODUCE:
I tried to perform
jlink
manually, I got following error message.IMPORTANT: Please readhttps://developer.android.com/studio/report-bugs.html carefully and supply
all required information.
Studio Build: 2022.3.1 OpenJDK 21 ea
Version of Gradle Plugin: 8.1.0
Version of Gradle: 8.2.1
Version of Java:
OS: Linux