我尝试了安装所有可能的 Java 文件的所有方法一百万次,我安装了最新的 gradle 版本,但它继续显示此错误.我在 Mac 上.请帮忙谢谢
I tried everything I installed every possible Java file a million times I installed the newest gradle version but it continues to show this error. I'm on Mac. Please help thanks
如果你不想为 Android 开发 Java 11 可以很好地使用 libgdx.
IF you do not want to develop for Android Java 11 works fine libgdx.
您必须在一切构建和运行之前更改一些内容.
这是我为使我的项目正常工作所做的工作.
我的上下文 Mac OSX 10.14 和 openJDK 11.0.2
、新项目、桌面启动器和一堆扩展(不重要).
You have to change some things before everything builds and runs.
Here's what I did to get my project working.
My context Mac OSX 10.14 and openJDK 11.0.2
, new project, Desktop launcher and a bunch of Extensions (not important).
/gradle/wrapper/gradle-wrapper.properties
并将 distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
更改为 distributionUrl=https://services.gradle.org/distributions/gradle-5.0-all.zip
.<project-dir>/gradle/wrapper/gradle-wrapper.properties
and change distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
into distributionUrl=https://services.gradle.org/distributions/gradle-5.0-all.zip
.这解决了 java 11 错误,只是为了让您遇到一个新错误Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
That resolves the java 11 error just to confront you with a new error Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
要摆脱这种情况,请打开 <project-dir>/desktop/build.gradle
并更改第 27 行(您可能会有所不同)从文件(sourceSets.main.output.classesDir)
到来自文件(sourceSets.main.output.classesDirs)
To get rid of that, open <project-dir>/desktop/build.gradle
and change line 27 (might be different for you)
from files(sourceSets.main.output.classesDir)
into
from files(sourceSets.main.output.classesDirs)
就是 classesDir
变成 classesDirs
这应该可以解决所有构建错误,您可以开始了.
This should resolve all build errors and you're good to go.
这篇关于Libgdx 无法确定 java 版本 11.0.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!