Unsupported Class File Major Version happens whenever you’re using a JDK which isn’t compatible with the gradle version used in the project.
This can be easily solved by commonly downgrading to a different version. For libGDX specifically 17 is a good choice. (Or for older projects 8).
If you don’t have a good one installed, I’d recommend to install Bellsofts JDK. The installer has good defaults, and even supports Oracle Specific tools like VisualVM.
gradle/wrapper/gradle-wrapper.properties in your project to figure out the gradle version (Check the distributionUrl). You can check the compatible JDK version on gradles website.
There are two steps to fix that in Intellij:
Settings, then extend
Build, Execution, Deployment ->
Build Tools and click on
Gradle. Change the
Gradle JVM to
Project structure, then change the
SDK to 11 (or 8). If you don’t want to install a JDK system wide, you can download one in the same drop down.
Gradle tab on the right of IntelliJ then click on the
Reload All Gradle Projects button.
After that step the project should work and IntelliJ should setup all the dependencies.
Gradle tab on the right of Android Studio, then click on the
Settings button and click on
In the newly opened dialog, change the
Gradle JDK to 11 (or 8).
Click on the
Elephant with blue arrow icon to resync the project.
After that step the project should work and Android Studio should setup all the dependencies.
I’m not really familiar with eclipse, but it looks like it doesn’t even allow you to import the gradle project when the project throws that error.
So make sure to change
Java home to an appropiate version:
If you however managed to open the project somehow, you can change the JDK version under
Properties. Then in the dialog select the
Gradle tab and change
Java home there.
After that resync the project by right clicking on the project in the
Package Explorer ->
Refresh Gradle Project.