General error during semantic analysis: Unsupported class file major version 57(语义分析期间的一般错误:不支持的类文件主要版本 57)
问题描述
我正在尝试为桌面游戏设置 libgdx,当我尝试生成项目时出现此错误并且构建失败.我有最新版本的 Java(13.0.2) 和 Gradle(6.6),它们都设置为路径中的环境变量.有人可以帮帮我吗?
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?
错误如下所示:
Could not compile settings file 'C:Users
oemiDesktopTestsettings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
java.lang.IllegalArgumentException: Unsupported class file major version 57
推荐答案
这不是 LibGDX 问题.Gradle 5 与 Java 13 不兼容.您需要将 Gradle(项目中的包装版本)更新到 Gradle 6 或更高版本,或者需要使用较低版本的 JRE.
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.
要更新打包的 gradle,请转到项目中的 gradle/wrapper/gradle-wrapper-properties 并更新版本号.我正在使用 6.1.1.
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
如果您有较旧的 LibGDX 项目,您可能需要修改 android 模块中的 build.gradle 文件以与 Gradle 6 兼容.您可以复制-粘贴以将 copyAndroidNatives 任务替换为 这里的那个.
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.
这篇关于语义分析期间的一般错误:不支持的类文件主要版本 57的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:语义分析期间的一般错误:不支持的类文件主要版
基础教程推荐
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- JPA惰性列表上的流 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- 将 double 转换为 Int,向下舍入 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
