简体   繁体   English

LibGDX无法创建项目

[英]LibGDX Failed to create Project

I cannot create a new libgdx project with the gdx-setup.jar. 我无法使用gdx-setup.jar创建一个新的libgdx项目。 It tells me the BUILD FAILED when I checked advanced > eclipse to use it in eclipse. 当我选中“高级> eclipse”以在eclipse中使用它时,它会告诉我BUILD FAILED。 It tells me the following: 它告诉我以下内容:

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

How can I fix this? 我怎样才能解决这个问题?

The problem isn't caused by a wrong libgdx installation. 问题不是由错误的libgdx安装引起的。

Please check that C:\\Program Files\\Java\\jre1.8.0_201 contains a valid JDK installation. 请检查C:\\ Program Files \\ Java \\ jre1.8.0_201是否包含有效的JDK安装。

Make sure your JAVA_HOME points to a JDK instead of a JRE. 确保您的JAVA_HOME指向JDK而不是JRE。

Also, it's a good idea that your JDK are the same version as what declared in the build.gradle found in each submodule (core, desktop, android, ios...). 另外,最好将您的JDK与每个子模块(核心,桌面,android,ios等)中的build.gradle中声明的版本相同。 You should find an entry similar to this: 您应该找到类似于以下内容的条目:

sourceCompatibility = '1.8'

So choose your JDK accordingly. 因此,请相应地选择您的JDK。

You seem to be using a JRE for gradle. 您似乎正在使用JRE作为gradle。 You need to be using a JDK, it can be downloaded here . 您需要使用JDK,可以在此处下载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM