Reputation: 96
I'm trying to run some tests on a libgdx project using JUnit and the following tutorial: http://manabreak.eu/java/2016/10/21/unittesting-libgdx.html
I added all dependencies to the module, yet I get the following error:
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx64.dll' for target: Windows 10, 64-bit
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:125)
at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:33)
at com.badlogic.gdx.backends.headless.HeadlessNativesLoader.load(HeadlessNativesLoader.java:24)
at com.badlogic.gdx.backends.headless.HeadlessApplication.<init>(HeadlessApplication.java:66)
at com.badlogic.gdx.backends.headless.HeadlessApplication.<init>(HeadlessApplication.java:59)
at Model.GameTest.init(GameTest.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: gdx64.dll at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:133) at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:289) at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:121) ... 20 more
Obviously, the HeadlessApplication cannot get access to the gdx64.dll, but I don't have any idea how to fix that. I also tried to add gdx.jar, gdx-backend-lwjgl-natives.jar, gdx-natives, but nothing works. A similar problem also occured when I used the gdx-setup.jar for a new project.
Any help is dearly appreciated!
Upvotes: 4
Views: 3550
Reputation: 63
I ran into this error when trying to run launchTestLwjgl3 gradle task from libgdx project. Fetching the native binaries with ./gradlew fetchNatives
fixed this for me.
https://libgdx.com/dev/from-source/
Upvotes: 6
Reputation: 6797
I fixed it by adding the following dependency to the main build.gradle, 'core' project:
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
Upvotes: 4