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
- Use JDK 21 for Capacitor 7 and later, JDK 17 for Capacitor 6.
- On GitHub Actions, add actions/setup-java with the temurin distribution and that java-version.
- 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.
