From f9a1606f89704acd5a5cdea47911924eacfebe56 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Mon, 25 Aug 2025 21:15:09 +0200 Subject: [PATCH] [android] Enable Java 21 Signed-off-by: Jean-Baptiste --- .github/workflows/android-check.yaml | 2 +- android/app/build.gradle | 16 ++++++++-------- docs/INSTALL.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/android-check.yaml b/.github/workflows/android-check.yaml index f87bfea69..9ba4c99c6 100644 --- a/.github/workflows/android-check.yaml +++ b/.github/workflows/android-check.yaml @@ -6,7 +6,7 @@ on: - main env: - JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin + JAVA_HOME: /usr/lib/jvm/temurin-21-jdk-amd64 # Java 21 is required for Android Gradle 8 plugin SKIP_MAP_DOWNLOAD: true jobs: diff --git a/android/app/build.gradle b/android/app/build.gradle index a46f3a8c1..c54408f79 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -29,12 +29,12 @@ def getCommitMessage() { project.ext.appId = 'app.comaps' project.ext.appName = 'CoMaps' -// I have Java 21 installed, but this doesn't work on MacOS. -//java { -// toolchain { -// languageVersion.set(JavaLanguageVersion.of(17)) -// } -//} + +java { + toolchain { + languageVersion.set(JavaLanguageVersion.of(21)) + } +} android { namespace = 'app.organicmaps' @@ -311,8 +311,8 @@ android { compileOptions { coreLibraryDesugaringEnabled = true - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_21 + targetCompatibility JavaVersion.VERSION_21 } } diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 73d4b8ff0..f515b45dc 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -245,7 +245,7 @@ Check if you have a system-wide Java Runtime Environment (JRE) installed: java -version ``` -If your system doesn't have a JRE installed or Java version is less than 17 (OpenJDK) +If your system doesn't have a JRE installed or Java version is less than 21 (OpenJDK) or you want command line builds to use a JRE version bundled with the Studio then set the `JAVA_HOME` environment variable: