java - LibGDX 创建项目失败

标签 java gradle libgdx

我无法使用 gdx-setup.jar 创建新的 libgdx 项目。当我检查高级> eclipse以在eclipse中使用它时,它告诉我构建失败。它告诉我以下内容:

Generating app in D:\programmierung\libgdx\test
Executing 'D:\programmierung\libgdx\test/gradlew.bat clean --no-daemon eclipse afterEclipseImport'
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
:core:clean
:desktop:clean UP-TO-DATE
:html:clean UP-TO-DATE
:eclipseProject
:eclipse
:core:eclipseClasspath
:core:eclipseJdt
:core:eclipseProject
:core:eclipse
:desktop:eclipseClasspath
:desktop:eclipseJdt
:desktop:eclipseProject
:desktop:eclipse
:html:eclipseClasspath
:html:eclipseJdt
:html:eclipseProject
:html:eclipseWtpComponent
:html:eclipseWtpFacet
:html:eclipseWtp
:html:generateGdt UP-TO-DATE
:core:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':core:compileJava'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_201 contains a valid JDK installation.

* 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 12s
18 actionable tasks: 15 executed, 3 up-to-date
Done!
To import in Eclipse: File -> Import -> General -> Existing Projects into Workspace
To import to Intellij IDEA: File -> Open -> YourProject.ipr

我该如何解决这个问题?

最佳答案

该问题不是由错误的 libgdx 安装引起的。

Please check that C:\Program Files\Java\jre1.8.0_201 contains a valid JDK installation.

确保您的 JAVA_HOME 指向 JDK 而不是 JRE。

此外,最好您的 JDK 与每个子模块(核心、桌面、android、ios...)中的 build.gradle 中声明的版本相同。 您应该找到与此类似的条目:

sourceCompatibility = '1.8'

因此请相应地选择您的 JDK。

关于java - LibGDX 创建项目失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55265766/

相关文章:

java - Selenium FindBy Amazon 搜索给出错误。 (java.lang.NullPointerException)

java - 程序无法识别字符串是什么

java - Play框架持久单元

gradle - Gradle任务的行为与Type修饰符不同

gradle - 如何让 gradle 在 war 文件中包含 *.ftl 文件

android - LibGDX 从 base64 PNG ByteArrayInputStream 创建纹理

java - libgdx 库的多态性错误

java - 反序列化对象后静态变量的值是多少?

Spring boot + gradle + tomcat Hello World 应用程序不工作

java - 为什么我的 Android 设备上没有调用 LibGDX 的 resume() 方法?