Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Java Runtime only recognizes class file versions up to 52.0

Errorhas been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Short answer

Class file 55 is Java 11 and 52 is Java 8. A tool built for Java 11 was started on a Java 8 runtime. Find the JDK that runs Gradle, then change it: the Gradle JDK setting in your IDE, JAVA_HOME in a terminal, or org.gradle.java.home. Android Gradle plugin 8 and newer needs JDK 17.

  • Applies to Gradle 8.x and 9.x, Android Gradle plugin 7.x to 9.x, IntelliJ IDEA and Android Studio 2026
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Print the Java version the terminal uses, then the one Gradle itself reports. They can differ from what your IDE uses.

    java -version
    ./gradlew --version
  2. 2Match what you see, then jump to its fix

    1. 1java -version prints 1.8 and the error appears when you run ./gradlew in a terminalThe terminal's JAVA_HOME or PATH points at Java 8Fix
    2. 2Sync fails inside Android Studio or IntelliJ, while a terminal build of the same project worksThe IDE's Gradle JDK setting is Java 8Fix
    3. 3Changing JAVA_HOME and the IDE setting makes no differenceorg.gradle.java.home in gradle.properties pins an old JDKFix

What does the error look like?

  • has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
  • Android Gradle plugin requires Java 17 to run. You are currently using Java 11.

Cause 1 of 3

The terminal's JAVA_HOME or PATH points at Java 8

1Check

In a terminal, JAVA_HOME decides which JDK runs the Gradle scripts, and the java on PATH is used if it is not set.

echo $JAVA_HOME
java -version

2Fix

Point JAVA_HOME at a newer JDK. AGP 7.0 needs JDK 11 and AGP 8.0 needs JDK 17; Gradle's own table lists Java 11 as the lowest it can run on from version 5.0.

export JAVA_HOME=/path/to/jdk-17
export PATH="$JAVA_HOME/bin:$PATH"

3Verify

Gradle reports a JVM of 11 or newer.

./gradlew --version

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

The IDE's Gradle JDK setting is Java 8

1Check

Buttons in Android Studio use the JDK chosen in its Gradle settings, stored as gradleJvm in .idea/gradle.xml, not the terminal's JAVA_HOME.

grep -n "gradleJvm" .idea/gradle.xml

2Fix

Open Settings, Build, Execution, Deployment, Build Tools, Gradle, and choose a JDK of 17 or newer in the Gradle JDK drop-down (the bundled jbr-17 is fine for Android projects).

# Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK

3Verify

Sync the project again; the error does not return.

./gradlew help

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 3

org.gradle.java.home in gradle.properties pins an old JDK

1Check

A gradle.properties file in the project or in the Gradle user home can set the JDK for the build process, and it ranks above JAVA_HOME.

grep -n "org.gradle.java.home" gradle.properties ~/.gradle/gradle.properties

2Fix

Remove the line, or point it at a newer JDK.

# gradle.properties
org.gradle.java.home=/path/to/jdk-17

3Verify

Run Gradle and read the JVM line.

./gradlew --version

Confirmed by docs.gradle.org

Did this fix it?

How do I stop it coming back?

  • Keep JAVA_HOME and the IDE's Gradle JDK on the same JDK.
  • Check the AGP release notes for the minimum JDK before upgrading the plugin.
  • Do not hard-code org.gradle.java.home to a path that only exists on your machine.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Android app crashes because the Apache HTTP classes are missing

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;

From Android 9 the Apache HTTP client is no longer on the default classpath, so code or a library that still uses org.apache.http fails at runtime.

2 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.