libgdx无法确定Java版本11.0.1 [英] Libgdx could not determine java version 11.0.1

查看:113
本文介绍了libgdx无法确定Java版本11.0.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了一切,我安装了最新的gradle版本,安装了所有可能的Java文件一百万次,但它继续显示此错误.我在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).

  1. 关于找不到Java 11.0.x的错误来自gradle.从gradle 5开始仅支持Java11.要使用gradle 5而不是4.6,将使用生成的项目进行配置,请转到<project-dir>/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.
  1. The error you get about not being able to find java 11.0.x comes from gradle. Java 11 is only supported since gradle 5. In order to use gradle 5 instead of 4.6 the generated project is configured with, go to <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.

  1. 要消除此问题,请打开<project-dir>/desktop/build.gradle并更改第27行(可能与您有所不同)
    from files(sourceSets.main.output.classesDir)放入
    from files(sourceSets.main.output.classesDirs)

  1. 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆