简体   繁体   English

如何修复“无法为目标加载共享库'libgdx64.so':Linux,64位”

[英]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. 显然,只有在使用这些库时才需要box2dbullet依赖项。


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.

相关问题 Libgdx无法为目标linux 32bit加载共享库gdx freetype,我该如何解决? - Libgdx couldnt load shared library gdx freetype for target linux 32bit, how do I fix? 如何修复“sqlite-3.7.2-sqlitejdbc.dll:无法在 AMD 64 位平台上加载 IA 32 位 .dll” - How to fix 'sqlite-3.7.2-sqlitejdbc.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform' 无法为目标加载共享库“gdx” - Couldn't load shared library 'gdx' for target 无法为目标加载共享库“ gdx-box2d.dll”:Windows 7,32位 - Couldn't load shared library 'gdx-box2d.dll' for target: Windows 7, 32-bit 无法为libgdx加载共享库box2d - Couldn't load shared library box2d for libgdx 如何为64位Linux机器编译Hadoop? - How to compile Hadoop for 64-bit Linux machine? 在64位Linux上安装Android ADT - Installing Android ADT on 64-bit Linux java.lang.UnsatisfiedLinkError:dlopen失败:.so库是64位而不是32位 - java.lang.UnsatisfiedLinkError: dlopen failed: .so library is 64-bit instead of 32-bit 无法在具有32位JVM的AMD 64位平台上加载IA 32位.dll - Can't load IA 32-bit .dll on a AMD 64-bit platform with 32 bit JVM 如何生成64位.dll哪个gcc编译器或其他。无法在AMD 64位平台上加载IA 32位.dll - How to generate 64 bit .dll which gcc compiler or other. Can't load IA 32-bit .dll on a AMD 64-bit platform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM