---
title: Override Java Version on Android Builds
description: Override the Java version used for Android builds in Capawesome Cloud. Configure JDK 17, JDK 21, or another version for your Capacitor project.
---

# 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:

1. Navigate to the [Environments](https://console.cloud.capawesome.io/apps/_/environments){:target="_blank"} page
2. Select your environment or create a new one
3. Add a variable named `JAVA_VERSION`
4. Set its value to the major version number (e.g., `17` or `21`)

???+ note "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](build-stacks.md) documentation.

## Example

To use Java 17 for your Android builds regardless of your Gradle Plugin version:

1. Add an environment variable named `JAVA_VERSION` with the value `17`
2. Select this environment when triggering your build

The specified Java version will be used instead of the automatically detected version.
