feat(cli): warn when Java is too new for the bundled Gradle - #15780
feat(cli): warn when Java is too new for the bundled Gradle#15780Legend-Master merged 10 commits into
Conversation
Installing a very recent JDK (e.g. Java 25/26) while Tauri ships Gradle 8.14 makes Android builds fail with a cryptic 'Failed to assemble APK' error. Detect the active Java feature version during the Android env setup and warn upfront when it exceeds what the bundled Gradle can run, pointing at the Gradle/Java compatibility matrix. Closes tauri-apps#15385
Package Changes Through 310ed2bThere are 14 changes which include tauri with minor, tauri-cli with minor, @tauri-apps/cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-bundler with minor, tauri-build with minor, tauri-macos-sign with minor, tauri-codegen with minor, tauri-macros with minor, tauri-plugin with minor, tauri-driver with minor, @tauri-apps/api with minor Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Read the major version from the JDK's `release` metadata file instead of running `java -version` on every Android command, so the compatibility warning no longer adds process-spawn overhead to init/dev/build.
|
@Legend-Master good point on the build overhead — I dropped the |
Read the Gradle version from the project's gradle-wrapper.properties instead of a hardcoded template constant, so the warning stays correct when users upgrade Gradle. Skip the warning when the project or Gradle version can't be determined (and for Gradle 9+, which tracks new Java quickly).
|
@Legend-Master good point — you're right that pinning to the template's Gradle version is wrong once the user upgrades their wrapper. Reworked in |
Legend-Master
left a comment
There was a problem hiding this comment.
Could you give this a spin see how long the whole process takes? Also let's move those checks to a dedicated file.
Extract the Java detection and Java/Gradle compatibility checks out of android/mod.rs into android/java.rs, and recommend the exact supported Java ceiling in the warning instead of a stale LTS list. Addresses @Legend-Master's feedback.
|
@Legend-Master pushed ec4f795:
|
the project path is only available after it
Closes #15385
Installing a very recent JDK (Java 25/26) while Tauri ships Gradle 8.14 makes Android builds fail with a cryptic
Failed to assemble APK with Io...error that gives no hint about the real cause.This adds an upfront check to the Android env setup (runs for
android init/dev/build): detect the active Java feature version viajava -version(preferringJAVA_HOME) andlog::warn!when it's newer than the bundled Gradle can run on, pointing at the Gradle/Java compatibility matrix and suggesting a supported JDK.The ceiling is a
MAX_SUPPORTED_JAVAconstant next to the existingNDK_VERSION/SDK_VERSIONconstants, to be bumped alongside the template's Gradle version. It's a warning only — nothing is blocked.Added a unit test for the version parser covering the modern (
21.0.1), single-number (26) and legacy (1.8.0_292) schemes.