user1857403
user1857403

Reputation: 309

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.

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

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.

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. I tried importing it by using import and also tried adding it as a external jar but still nothing works. 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.

Thanks

Upvotes: 1

Views: 3234

Answers (1)

tdgtyugdyugdrugdr
tdgtyugdyugdrugdr

Reputation: 826

Did you also reference gdx-box2d-natives.jar in your desktop project? Anyway, here's how my project libs are. Look at the box2d ones (except box2dlights).

enter image description here

Also after setting references, I know it will sound stupid, but do a project clean up and restart Eclipse if you're using it. 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 is love. Eclipse is life.

Eclipse love

Upvotes: 2

Related Questions