Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

General error during semantic analysis: Unsupported class file major version 57

I'm trying to setup libgdx for a desktop game and when I try to generate the project I have this error and the build fails. I've the latest versions of Java(13.0.2) and Gradle(6.6), both set as environment variables in the path. Can somebody help me?

The error looks like this:

Could not compile settings file 'C:\Users\noemi\Desktop\Test\settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 57
  
  java.lang.IllegalArgumentException: Unsupported class file major version 57 
like image 674
Noemi Avatar asked Aug 20 '20 10:08

Noemi


2 Answers

This is not a LibGDX issue. Gradle 5 is incompatible with Java 13. You either need to update Gradle (the wrapped version in your project) to Gradle 6 or later, or you need to use a lower version of the JRE.

To update the wrapped gradle, go to gradle/wrapper/gradle-wrapper-properties in your project and update the version number. I'm using 6.1.1.

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

If you have an older LibGDX project, you might have to modify the build.gradle file in the android module to be compatible with Gradle 6. You can copy-paste to replace the copyAndroidNatives task with the one here.

like image 166
Tenfour04 Avatar answered Sep 19 '22 13:09

Tenfour04


startup failed: General error during semantic analysis: Unsupported class file major version 61

how to fix this react native issues JAVA JDK 17

Go to the android/ directory of your react-native project

Create a file called local.properties with this line:

sdk.dir=C:\Android\sdk

GOTO android\gradle\wrapper\gradle-wrapper.properties

CHANGE

distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip

TO

distributionUrl=https://services.gradle.org/distributions/gradle-7.3-all.zip

GOTO

android\gradle.properties add this line

org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
like image 44
Don Ejeh Avatar answered Sep 20 '22 13:09

Don Ejeh