Search code examples
javalibgdx

LibGdx project setup - Project generated with gradle error


I am trying to generate the LibGdx based project using the tool gdx-setup.jar

I am getting some strange errors that I have not faced before. Could you please assist me in generating the project successfully ?

Generating app in C:\Games\Jewel Games New Executing 'C:\Games\Jewel Games New/gradlew.bat clean --no-daemon' To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.6/userguide/gradle_daemon.html. Daemon will be stopped at the end of the build stopping after processing

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Games\Jewel Games New\build.gradle' line: 57

* What went wrong:
A problem occurred evaluating root project 'Jewel Games New'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version

52.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 16s
Done!
To import in Eclipse: File -> Import -> Gradle -> Gradle Project
To import to Intellij IDEA: File -> Open -> build.gradle
To import to NetBeans: File -> Open Project...

Solution

  • java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

    major.minor version 52.0 error is possibly because the jar was compiled in JDK 1.8, but you are trying to run it using a JDK 1.7 environment.

    To solve this, it's always better to have the JDK and JRE pointed to the same version.