Android build

Android Gradle plugin requires Java 17 to run

Wrong Java version for Gradle

Android Gradle plugin requires Java 17 to run. The Android Gradle plugin needs a specific JDK, and newer Capacitor versions need a newer Java than the one installed.

Updated

What this error means

The Android Gradle plugin needs a specific JDK, and newer Capacitor versions need a newer Java than the one installed.

Why it happens

The Android Gradle plugin refuses to run on a JDK older than the one it was built for. Newer Capacitor versions raise that requirement (JDK 21 from Capacitor 7, JDK 17 for Capacitor 6). The log names the version it wanted.

The message tools print

Android Gradle plugin requires Java 17 to run. You are currently using Java 11.

How to fix it

  1. Use JDK 21 for Capacitor 7 and later, JDK 17 for Capacitor 6.
  2. On GitHub Actions, add actions/setup-java with the temurin distribution and that java-version.
  3. Locally, point Android Studio’s Gradle JDK at the same version.

Check a log that shows this

Paste the failing step into the build error explainer. It matches this message, and any others in the same log, in your browser. Nothing is uploaded.

Other Android build errors

Let the Android build run in CI

CapWrapp builds the release on GitHub Actions with the JDK and Android SDK the project needs, and signs it with the upload keystore it stores for you.

  • Free to start
  • No credit card
  • Sign in with Google or GitHub