Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile under openjdk 21 #178

Open
YesThatGy opened this issue Oct 16, 2024 · 2 comments
Open

Unable to compile under openjdk 21 #178

YesThatGy opened this issue Oct 16, 2024 · 2 comments

Comments

@YesThatGy
Copy link

Repeated failure compiling on AndroidStudio 2024.2.1 (Lady Bug) with Java 21, on Fedora Core 40 or OSX Sequoia. Works fine with java 17 and AndroidStudio 2024.1.1.

Here's the complete output I get when I run gradlew build:

./gradlew build

Configure project :app
You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/to/flutter-gradle-plugin-apply

Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 34

This Android Gradle plugin (7.4.2) was tested up to compileSdk = 33

This warning can be suppressed by adding
android.suppressUnsupportedCompileSdk=34
to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to
use a newer Android Gradle Plugin that has been tested with compileSdk = 34

Task :flutter_contacts:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':flutter_contacts:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':flutter_contacts: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: /home/as/Android/Sdk/platforms/android-34/core-for-system-modules.jar.
> Error while executing process /usr/lib/jvm/java-21-openjdk-21.0.4.0.7-2.fc40.x86_64/bin/jlink with arguments {--module-path /home/as/.gradle/caches/8.9/transforms/c10b202ceb5416599890c387b9da5235-94742421-91e7-4f8f-ab84-e78dc738b66c/transformed/output/temp/jmod --add-modules java.base --output /home/as/.gradle/caches/8.9/transforms/c10b202ceb5416599890c387b9da5235-94742421-91e7-4f8f-ab84-e78dc738b66c/transformed/output/jdkImage --disable-plugin system-modules}

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.9/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 19s
139 actionable tasks: 6 executed, 133 up-to-date
as@tesla:~/development/shar2/android$

@anilthapa1939
Copy link

Same issue here

@evanrich
Copy link

evanrich commented Nov 1, 2024

if you take a look at the PR where they updated it for jdk 17, you could probably fork this and update to jdk21 yourself, likely just requires changing a few lines from something like JAVA_17 to JAVA_21...etc (paraphrasing here)

PR's are probably welcome as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants