[英]How to fix “Couldn't load shared library 'libgdx64.so' for target: Linux, 64-bit”
I am trying to use the headless LibGDX for unit testing, but when I run the test I get this error: 我正在尝试使用无头LibGDX进行单元测试,但是当我运行测试时出现此错误:
Couldn't load shared library 'libgdx64.so' for target: Linux, 64-bit
无法为目标加载共享库'libgdx64.so':Linux,64位
I read here that I need to add gdx-natives.jar
. 我在这里读到我需要添加
gdx-natives.jar
。 Is this correct, and where can I find this file? 这是正确的,我在哪里可以找到这个文件?
Also, where in my project should I add the file? 另外,我的项目应该在哪里添加文件?
I found the answer on this BitBucket repo . 我找到了这个BitBucket回购的答案。 The README gives a nice explanation of how to implement this using Gradle.
README给出了一个很好的解释,说明如何使用Gradle实现它。
Basically, you just add GdxTestRunner.java from that repo, and then add a @RunWith
to each of your test files: 基本上,您只需从该存储库添加GdxTestRunner.java ,然后在每个测试文件中添加
@RunWith
:
@RunWith(GdxTestRunner.class)
public class MyClassTest {
...
}
Then in your root level build.gradle
file, add something like this to your core
dependencies: 然后在您的根级
build.gradle
文件中,将这样的内容添加到您的core
依赖项:
testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
testCompile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
testCompile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
testCompile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
Obviously the box2d
and bullet
dependencies are only necessary if you are using those libraries. 显然,只有在使用这些库时才需要
box2d
和bullet
依赖项。
On the BitBucket repo README, the example includes both 在BitBucket repo README上,该示例包括两者
testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
and 和
compile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"
I don't think it is necessary to include this for compile
, and if I correctly understand how Gradle works, it will actually slow down your build. 我不认为有必要将其包含在
compile
,如果我正确理解Gradle如何工作,它实际上会减慢你的构建速度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.