How can I fix "unsupported class file major version 60" in IntelliJ IDEA?

Solution 1:

I fixed this problem by changing the Gradle JVM settings in IntelliJ settings:

  • In the Settings/Preferences dialog, go to Build, Execution, DeploymentBuild ToolsGradle.

  • Under the Gradle section, change the Gradle JVM option. Select a Gradle JVM which works for you.

    Enter image description here

See Resolve the Gradle JVM version for the existing project

Solution 2:

For me, it was fixed by upgrading the Gradle version.

In the file under the directory gradle/wrapper/gradle-wrapper.properties, just change the version number of Gradle. For example, if your Gradle version is 6.3, change this:

distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip

to:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip

It is not available in FileProject StructureProject for the project I was working with.

Solution 3:

Upgrading Gradle version 6.8.3 to 7.0 solved my problem. You can upgrade it:

  • Menu FileProject StructureProject (on the left panel)
  • Change to Gradle version 7.0

It works with the Android Gradle plugin version 4.2.0.