无法加载共享库GDX Freetype Mac

时间:2014-05-26 19:50:39

标签: java macos libgdx

我最近切换到了Mac OSX,当我打开一个我在Windows上开发的项目时,我收到了这个错误:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdx-freetype64.dylib' for target: Mac OS X, 64-bit
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115)
at com.badlogic.gdx.graphics.g2d.freetype.FreeType.initFreeType(FreeType.java:541)
at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.<init>(FreeTypeFontGenerator.java:102)
at com.evh98.lithium.ui.Central.load(Central.java:43)
at com.evh98.lithium.Lithium.create(Lithium.java:60)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: libgdx-freetype64.dylib
at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:124)
at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:245)
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:113)
... 6 more

非常感谢任何帮助,提前谢谢。

2 个答案:

答案 0 :(得分:0)

使用LibGDX 1.9.6,您需要确保在build.gradle

中添加适当的依赖项

https://github.com/libgdx/libgdx/wiki/Dependency-management-with-Gradle#freetypefont-gradle

  FreeTypeFont Gradle      

核心依赖关系:

     

compile&#34; com.badlogicgames.gdx:gdx-freetype:$ gdxVersion&#34;

     

桌面相关性:

     

compile&#34; com.badlogicgames.gdx:gdx-freetype-platform:$ gdxVersion:natives-desktop&#34;

答案 1 :(得分:-2)

我有同样的问题,但我通过升级gdx-box2d.jar和

解决了这个问题

gdx-box2d-natives.jar然后再次构建路径。

我认为这个问题是由GL版本引起的。