无法为libgdx加载共享库box2d [英] Couldn't load shared library box2d for libgdx

查看:142
本文介绍了无法为libgdx加载共享库box2d的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用maven构建的libGDX项目.过去运行良好,但最近由于libGDX将box2d移至扩展程序而停止工作.我像其他任何依赖项一样,将扩展作为依赖项添加到项目的核心中:

I have a libGDX project that is built using maven. It's run fine in the past, but recently, it's stopped working, due to libGDX moving box2d to being an extension. I added the extension as a dependency to the core of my project like I would any other dependency:

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

但是,当我尝试在桌面上运行项目(或其他任何事情)时,出现以下错误:

however, when I try to run the project for desktop (or anything else, really), I get the following error:

[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

有人知道此错误的含义以及如何解决吗?我不确定应该提供什么其他信息,不过如果需要,我将添加所需的任何代码或信息.

Does anyone know what this error means and how I might fix it? I'm not sure what other information I should provide, though I'll add any code or information needed if asked.

推荐答案

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

You'll also have to add the artifacts containing the native libraries, for the desktop

<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包含相同的依赖项

You have to include the same dependency for Android and iOS, using a different classifier (natives-x86, natives-armebi, natives-armeabiv7, natives-ios)

这篇关于无法为libgdx加载共享库box2d的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆