Override Java version on Android builds
Starting with the build stack Linux 2021.09
Appflow tries to detect which version of the Android Gradle Plugin is used in the project.
Starting with build stack Linux 2025.01
, Java 21 was added to support Capacitor 7 projects.
Here is how the Gradle Plugin version maps to the Java version used:
Gradle Plugin Version | Java Version |
---|---|
<= 6 | 8 |
7 | 11 |
8.0.0 - 8.7.1 | 17 |
<= 8.7.2 | 21* |
For Gradle Plugin versions >= 8.7.2, Java 21 is recommended and will be used if available. Systems will automatically fall back to Java 17 if Java 21 is not available
If a specific version of Java is needed, it is possible to override the automatic detection using OVERRIDE_JAVA_VERSION
environment variable.
Notes
The environment variable OVERRIDE_JAVA_VERSION
can only be set to an integer representing the major version, such as 17
. Even if 17.0.6
is a valid version, it is not a valid input.
If OVERRIDE_JAVA_VERSION
is set to an invalid or unavailable version the build will fail.
Always refer to the Build Stacks page for the most up to date values.