【问题标题】:LibGDX Failed to create ProjectLibGDX 无法创建项目
【发布时间】:2019-03-21 16:48:03
【问题描述】:

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

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

我该如何解决这个问题?

【问题讨论】:

  • 从突出显示的部分来看,您似乎正在使用 JRE 而不是 JDK 运行/构建。

标签: java gradle libgdx


【解决方案1】:

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

请检查 C:\Program Files\Java\jre1.8.0_201 是否包含有效的 JDK 安装。

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

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

sourceCompatibility = '1.8'

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

【讨论】:

    【解决方案2】:

    您似乎正在使用 JRE 进行 gradle。您需要使用JDK,可以下载here

    【讨论】:

      猜你喜欢
      • 2014-06-11
      • 1970-01-01
      • 2014-06-25
      • 1970-01-01
      • 1970-01-01
      • 2019-03-31
      • 2013-07-28
      • 2020-10-11
      • 2018-05-06
      相关资源
      最近更新 更多