Override Java Version on Android Builds¶
Capawesome Cloud automatically detects the Android Gradle Plugin version used in your project and applies the corresponding Java version. However, you can manually override the Java version if needed.
Automatic Java Version Detection¶
Capawesome Cloud supports Gradle Plugin Version 8.0.0 and higher. The Java version is automatically selected based on your Android Gradle Plugin version:
| Android Gradle Plugin | Java Version |
|---|---|
| 8.0.0 - 8.7.1 | 17 |
| >= 8.7.2 | 21 |
This automatic detection ensures your builds use the appropriate Java version without additional configuration.
Override Java Version¶
To override the automatic Java version selection, set the JAVA_VERSION environment variable:
- Navigate to the Environments page
- Select your environment or create a new one
- Add a variable named
JAVA_VERSION - Set its value to the major version number (e.g.,
17or21)
Version constraints
The JAVA_VERSION environment variable must be set to an integer representing the major version, such as 17 or 21. For available Java versions, refer to the Build Stacks documentation.
Example¶
To use Java 17 for your Android builds regardless of your Gradle Plugin version:
- Add an environment variable named
JAVA_VERSIONwith the value17 - Select this environment when triggering your build
The specified Java version will be used instead of the automatically detected version.