简体   繁体   English

无法为目标加载共享库“ gdx-box2d.dll”:Windows 7,32位

[英]Couldn't load shared library 'gdx-box2d.dll' for target: Windows 7, 32-bit

I've checked other Questions and answers on here but still can't figure it out. 我在这里检查了其他问题和答案,但仍然无法解决。 I'm using eclipse with the android sdk installed and following the Learning Libgdx Game Development book. 我正在使用安装了android sdk的eclipse,并遵循《学习Libgdx游戏开发》一书。

The game worked fine on the desktop until I got to the chapter 11 about Box2D and now the game menu loads but when I go to play it crashes and I get 在我进入关于Box2D的第11章之前,该游戏在台式机上运行良好,现在加载了游戏菜单,但是当我玩时它崩溃了,我得到了

Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx-box2d.dll' for target: Windows 7, 32-bit
    at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:117)
    at com.badlogic.gdx.physics.box2d.World.<clinit>(World.java:187)
    ... 20 more
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Unable to read file for extraction: gdx-box2d.dll
    at com.badlogic.gdx.utils.SharedLibraryLoader.readFile(SharedLibraryLoader.java:126)
    at com.badlogic.gdx.utils.SharedLibraryLoader.loadFile(SharedLibraryLoader.java:261)
    at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:115)
    ... 21 more

One answer I found online said "You'll also have to add the artifacts containing the native libraries, for the desktop" found this here Couldn't load shared library box2d for libgdx . 我在网上找到的一个答案说:“您还必须为桌面添加包含本机库的工件”,这是在这里找到的。无法为libgdx加载共享库box2d

In my core project I have referenced libraries that has the gdx-box2d-1.5.3.jar but in the desktop I don't have that. 在我的核心项目中,我引用了具有gdx-box2d-1.5.3.jar的库,但是在桌面上却没有。 I tried importing it by using import and also tried adding it as a external jar but still nothing works. 我尝试使用import导入它,还尝试将其添加为外部jar,但仍然无效。 Any suggestions would be greatly appreciated or a point in the right direction if this is already answered. 如果已经回答了任何建议,将不胜感激,或者指出正确的方向。

Update: I now actually have the gdx-box2d.jar in the desktop part of the project but still doesn't work and getting same error in the console. 更新:我现在实际上在项目的桌面部分中有gdx-box2d.jar,但仍然无法正常工作,并且在控制台中出现了相同的错误。

Thanks 谢谢

Did you also reference gdx-box2d-natives.jar in your desktop project? 您是否还在桌面项目中引用了gdx-box2d-natives.jar? Anyway, here's how my project libs are. 无论如何,这就是我的项目库的样子。 Look at the box2d ones (except box2dlights). 查看box2d的那些(box2dlights除外)。

在此处输入图片说明

Also after setting references, I know it will sound stupid, but do a project clean up and restart Eclipse if you're using it. 同样在设置引用之后,我知道它听起来很愚蠢,但是如果您使用它,请清理项目并重新启动Eclipse。 I lost count of how many times I've tried to fix an error that was not supposed to happen in the first place, and got fixed after restarting Eclipse. 我记不清试图修复最初不应该发生的错误的次数,而在重新启动Eclipse之后得到修复。

Eclipse is love. Eclipse是爱。 Eclipse is life. Eclipse是生命。

蚀爱

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM