libgdx在Mac上抛出异常,无法加载共享库libgdx-controllers-desktop.dylib。

4

我有一个关于libgdx的问题。

它显示:

Couldn't load shared library 'libgdx-controllers-desktop.dylib' for target: Mac OS X, 32-bit

你有什么建议吗?

完整异常信息:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: com.badlogic.gdx.utils.GdxRuntimeException: Error creating controller manager: com.badlogic.gdx.controllers.desktop.DesktopControllerManager
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error creating controller manager: com.badlogic.gdx.controllers.desktop.DesktopControllerManager
    at com.badlogic.gdx.controllers.Controllers.initialize(Controllers.java:101)
    at com.badlogic.gdx.controllers.Controllers.getControllers(Controllers.java:47)
    at de.datpixelstudio.canopus.states.GameState.init(GameState.java:50)
    at de.datpixelstudio.statebasedgame.StateBasedGame.enterState(StateBasedGame.java:97)
    at de.datpixelstudio.statebasedgame.State.enterState(State.java:54)
    at de.datpixelstudio.statebasedgame.InputHandlerMain.keyDown(InputHandlerMain.java:41)
    at com.badlogic.gdx.InputMultiplexer.keyDown(InputMultiplexer.java:70)
    at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:277)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:187)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdx-controllers-desktop.dylib' for target: Mac OS X, 32-bit
    at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:104)
    at com.badlogic.gdx.controllers.desktop.DesktopControllerManager.<init>(DesktopControllerManager.java:30)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at com.badlogic.gdx.controllers.Controllers.initialize(Controllers.java:99)
    ... 9 more
Caused by: java.lang.NullPointerException
    at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:102)
    ... 17 more

这是2013年1月12日的夜间版本


1
“libgdx-controllers-desktop.dylib” 应该在 gdx-controllers-desktop-natives.jar 中,是否已经在你的类路径上?SharedLibraryLoader 有一些新的“提取”代码(请参见 https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/utils/SharedLibraryLoader.java),这可能会在你的系统上引起问题... - P.T.
那就是问题所在 :) 忘记放 gdx-controllers-desktop-natives.jar 了。谢谢。 - Angelo Walczak
1个回答

2

哦,问题出在这里。我忘记把gdx-controllers-desktop-natives.jar导入了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接