无法为libgdx加载共享库box2d

时间:2014-04-18 21:13:29

标签: java maven libgdx box2d

我有一个使用maven构建的libGDX项目。它在过去运行良好,但最近由于libGDX将box2d移动为扩展,它已停止工作。我将扩展作为依赖项添加到项目的核心,就像我对任何其他依赖项一样:

<dependency>
    <groupId>com.badlogicgames.gdx</groupId>
    <artifactId>gdx-box2d</artifactId>
    <version>${gdx.version}</version>
    <scope>compile</scope>
</dependency>

然而,当我尝试运行桌面项目(或其他任何东西,真的)时,我收到以下错误:

[java] Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx-box2d64.dll' for target: Windows 7, 64-bit
[java]  at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115)
[java]  at com.badlogic.gdx.physics.box2d.World.<clinit>(World.java:185)
[java]  ... 11 more
[java] Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: gdx-box2d64.dll
[java]  at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:124)
[java]  at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:245)
[java]  at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:113)
[java]  ... 12 more

有谁知道这个错误意味着什么以及我如何解决它?我不确定我应该提供哪些其他信息,但如果我被要求,我会添加所需的任何代码或信息。

1 个答案:

答案 0 :(得分:4)

您还必须为桌面添加包含本机库的工件

<dependency>
    <groupId>com.badlogicgames.gdx</groupId>
    <artifactId>gdx-box2d-platform</artifactId>
    <classifier>natives-desktop</classifier>
    <version>${gdx.version}</version>
    <scope>compile</scope>
</dependency>

您必须使用不同的分类器(natives-x86,natives-armebi,natives-armeabiv7,natives-ios)为Android和iOS添加相同的依赖项