How to fix "Failed to load shared library libgdx64.so" for target: Linux 64-bit "

I'm trying to use the headless LibGDX for unit testing, but when I run the test, I get this error:

Failed to load shared library libgdx64.so for Linux: 64-bit, 64-bit

I read here what I need to add gdx-natives.jar

. Is this correct and where can I find this file?

Also, where in my project should I add the file?

+3


source to share


1 answer


I found the answer to this BitBucket repository . The README gives a good explanation on how to implement this using Gradle.

Basically, you just add the GdxTestRunner.java from that repo and then add @RunWith

to each of the test files:

@RunWith(GdxTestRunner.class)
public class MyClassTest {
    ...
}

      

Then, in your root level, build.gradle

add something like this to your dependencies 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, dependencies are box2d

and bullet

are only needed if you are using these libraries.




In the README of the BitBucket repository, the example includes both

testCompile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"

      

and

compile "com.badlogicgames.gdx:gdx-backend-headless:$gdxVersion"

      

I don't think it needs to be enabled for compile

, and if I understand correctly how Gradle works, it will actually slow down your build.

+4


source







All Articles