java - LIBGDX - 加载 libgdx/测试很困难

标签 java eclipse gradle ant libgdx

我一直在尝试加载测试存储库 libgdx/tests在 eclipse 中运行了几个小时,但没有成功。

我使用的是 JRE 1.8,但编译器合规级别为 1.7。我已经按照这里的教程How to running tests进行操作设置 ANT (1.9.7) 和 GWT(2.6.1 [按照教程中的建议])。

我已经清理了所有项目并刷新了它们。我仍然收到一大堆错误,因为找不到 jar(请不要告诉我它们必须手动添加:?):

Description Resource    Path    Location    Type
Project 'gdx-backend-jglfw' is missing required library: '/gdx/libs/gdx-natives.jar'    gdx-backend-jglfw       Build path  Build Path Problem
Project 'gdx-backend-jglfw' is missing required library: 'libs/gdx-backend-jglfw-natives.jar'   gdx-backend-jglfw       Build path  Build Path Problem
Project 'gdx-backend-jglfw' is missing required library: 'libs/jglfw.jar'   gdx-backend-jglfw       Build path  Build Path Problem
Project 'gdx-backend-lwjgl' is missing required library: '/gdx/libs/gdx-natives.jar'    gdx-backend-lwjgl       Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: '/gdx/libs/gdx-natives.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-glfw-natives-linux.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-glfw-natives-macos.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-glfw-natives-windows.jar' gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-glfw.jar' gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-jemalloc-natives-linux.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-jemalloc-natives-macos.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-jemalloc-natives-windows.jar' gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-jemalloc.jar' gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-natives-linux.jar'    gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-natives-macos.jar'    gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-natives-windows.jar'  gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-openal-natives-linux.jar' gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-openal-natives-macos.jar' gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-openal-natives-windows.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-openal.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-opengl.jar'   gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-stb-natives-linux.jar'    gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-stb-natives-macos.jar'    gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-stb-natives-windows.jar'  gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl-stb.jar'  gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-lwjgl3' is missing required library: 'libs/lwjgl.jar'  gdx-backend-lwjgl3      Build path  Build Path Problem
Project 'gdx-backend-robovm' is missing required library: 'libs/robovm-cacerts-full.jar'    gdx-backend-robovm      Build path  Build Path Problem
Project 'gdx-backend-robovm' is missing required library: 'libs/robovm-cocoatouch.jar'  gdx-backend-robovm      Build path  Build Path Problem
Project 'gdx-backend-robovm' is missing required library: 'libs/robovm-objc.jar'    gdx-backend-robovm      Build path  Build Path Problem
Project 'gdx-backend-robovm' is missing required library: 'libs/robovm-rt.jar'  gdx-backend-robovm      Build path  Build Path Problem
Project 'gdx-bullet' is missing required library: 'libs/gdx-bullet-natives.jar' gdx-bullet      Build path  Build Path Problem
Project 'gdx-controllers-desktop' is missing required library: 'libs/gdx-controllers-desktop-natives.jar'   gdx-controllers-desktop     Build path  Build Path Problem
Project 'gdx-freetype' is missing required library: 'libs/gdx-freetype-natives.jar' gdx-freetype        Build path  Build Path Problem
Project 'gdx-tests-android' is missing required source folder: 'gen'    gdx-tests-android       Build path  Build Path Problem
Project 'gdx-tests-lwjgl' is missing required library: '/gdx-box2d/libs/gdx-box2d-natives.jar'  gdx-tests-lwjgl     Build path  Build Path Problem
Project 'gdx-tests-lwjgl' is missing required library: '/gdx-controllers-desktop/libs/gdx-controllers-desktop-natives.jar'  gdx-tests-lwjgl     Build path  Build Path Problem
Project 'gdx-tests-lwjgl' is missing required library: '/gdx-freetype/libs/gdx-freetype-natives.jar'    gdx-tests-lwjgl     Build path  Build Path Problem
Project 'gdx-tests-lwjgl3' is missing required library: '/gdx-box2d/libs/gdx-box2d-natives.jar' gdx-tests-lwjgl3        Build path  Build Path Problem
Project 'gdx-tests-lwjgl3' is missing required library: '/gdx-controllers-desktop/libs/gdx-controllers-desktop-natives.jar' gdx-tests-lwjgl3        Build path  Build Path Problem
Project 'gdx-tests-lwjgl3' is missing required library: '/gdx-freetype/libs/gdx-freetype-natives.jar'   gdx-tests-lwjgl3        Build path  Build Path Problem
Project 'gdx' is missing required library: 'libs/hamcrest-core-1.3.jar' gdx     Build path  Build Path Problem
Project 'gdx' is missing required library: 'libs/junit-4.11.jar'    gdx     Build path  Build Path Problem
Unbound classpath container: 'GWT SDK [missing]' in project 'gdx-backends-gwt'  gdx-backends-gwt        Build path  Build Path Problem
Unbound classpath container: 'GWT SDK [missing]' in project 'gdx-box2d-gwt' gdx-box2d-gwt       Build path  Build Path Problem
Unbound classpath container: 'GWT SDK [missing]' in project 'gdx-controllers-gwt'   gdx-controllers-gwt     Build path  Build Path Problem
Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment.     gdx-controllers-gwt     Build path  JRE System Library Problem

注意:我知道这个问题:libGDX - gdx-backend-jglfw is missing and some others但它相当旧,因此库已更改,并且没有发布解决方案。

最佳答案

Eclipse 提示您的 JRE(堆栈底部):

Build path specifies execution environment JavaSE-1.7. There are no JREs installed in the workspace that are strictly compatible with this environment. gdx-controllers-gwt Build path JRE System Library Problem

您需要在项目JRE1.7中预配置to set the property in Eclipse

==============

其他构建路径问题应通过运行 ant -f fetch.xml 来解决 - 确保它成功。

或者,您可以运行更具体的 ant 任务,例如ant -f fetch.xml fetch-lwjgl 解决依赖关系,这应该修复

Project 'gdx-backend-lwjgl3' is missing required library

==============

对于缺少 GWT SDK 问题:

  • 确保您做到了:

    GWT Plugin for Eclipse - follow the instructions on the page and install only required and GWT stuff Also make sure that default GWT SDK is 2.6.1. You will probably have to download it here and install it by going to Window/Eclipse -> Preferences -> Google -> Web Toolkit -> Add and then make sure it is checked.

  • 检查它是否确实存在:例如右键单击gdx-backends-gwt项目构建路径 - 配置构建路径 - 选项卡 它不应该有错误并提供正确的路径,例如:

enter image description here

  • 对所有三个错误项目执行上述操作 gdx-backends-gwtgdx-box2d-gwtgdx-controllers-gwt<

顺便说一句,2016 年 12 月 12 日开发人员将其更改为 gwt-2.8.0,请参阅 commit a748656a ,所以可能尚未更新指令

==============

我也做了./gradlew build - 但我认为这不是导致你的问题的原因

不要忘记清理重建你的 Eclipse:

To resolve the issues do the following:

Go to Project -> Clean Make sure all projects are selected, then click OK

Select all projects in the package explorer, then hit F5 to refresh them (vodoo...)

There will be a few issues remaining concerning GWT. In the Problems view, right click on each entry saying "The web.xml file does not exist", select Quick Fix and press OK

即使完成后我仍然有问题:)

The project was not built since its build path is incomplete. Cannot find the class file for org.robovm.apple.uikit.UIApplicationDelegateAdapter.

关于java - LIBGDX - 加载 libgdx/测试很困难,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41283267/

相关文章:

java - 未安装 Azure CLI。但确实是这样

java - 如何获取kafka的消费者offset值

java - System.out.println() 快捷方式不起作用

java - 声明的包与预期的包不匹配 ""

windows - 符号 § 的 Eclipse 问题

gradle - 在gradle中引用另一个jar的库文件夹中的jar - 找不到类

android - 无法在 android 变体应用程序中绑定(bind)服务

java - Java Random 对象可以在同一种子的不同执行中给出不同的结果吗?

java - 在 Java (Android) 中以 YYYY-MM-DD 格式获取当前日期

c# - Bouncy CaSTLe 不在 C# 中从 Java 解密 DoFinal