我正在按照这些说明将我的libgdx项目转换为maven。但是我的项目需要freetype,并且我对如何添加它的依赖关系感到困惑:
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: libgdx-freetype64.so
at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:119)
at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:231)
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:108)
... 7 more
以下是我的桌面/pom.xml文件:
<dependencies>
<dependency>
<groupId>com.autonomousgames.starcycle</groupId>
<artifactId>starcycle-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx</artifactId>
<version>${gdx.version}</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-freetype-platform</artifactId>
<version>${gdx.version}</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-freetype</artifactId>
<version>${gdx.version}</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-backend-lwjgl</artifactId>
<version>${gdx.version}</version>
</dependency>
<dependency>
<groupId>com.badlogicgames.gdx</groupId>
<artifactId>gdx-platform</artifactId>
<version>${gdx.version}</version>
<classifier>natives-desktop</classifier>
</dependency>
编辑:当我运行“mvn clean install -Pdesktop”时,会得到以下结果:
main:
[java] Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ExceptionInInitializerError
[java] at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
[java] Caused by: java.lang.ExceptionInInitializerError
[java] at com.autonomousgames.starcycle.core.screens.SplashScreen.<init>(SplashScreen.java:20)
[java] at com.autonomousgames.starcycle.core.StarCycle.create(StarCycle.java:40)
[java] at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
[java] at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
[java] Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'libgdx-freetype64.so' for target: Linux, 64-bit
[java] at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:110)
[java] at com.badlogic.gdx.graphics.g2d.freetype.FreeType.initFreeType(FreeType.java:541)
[java] at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.<init>(FreeTypeFontGenerator.java:101)
[java] at com.autonomousgames.starcycle.core.Texturez.<clinit>(Texturez.java:261)
[java] ... 4 more
[java] Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: libgdx-freetype64.so
[java] at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:119)
[java] at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:231)
[java] at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:108)
[java] ... 7 more
gdx-platform
依赖项中,它就可以工作了。 您是否找到一些说明如何使用此功能的文档? - DavidS