简体   繁体   English

使用Box2d libgdx for android的UnsatisfiedLinkError

[英]UnsatisfiedLinkError using Box2d libgdx for android

I am trying to use the libGDX box2d wrapper, but I do not want to use the the full libGDX game engine, because I already have my game implemented and now I want to add some physics. 我正在尝试使用libGDX box2d包装器,但我不想使用完整的libGDX游戏引擎,因为我已经实现了我的游戏,现在我想添加一些物理。

So, I downloaded the libGDX libraries and put them in build path. 所以,我下载了libGDX库并将它们放在构建路径中。

I see the following error: 我看到以下错误:

UnsatisfiedLinkError at com.badlogic.gdx.physics.box2d.World.newWorld(Native Method)
at com.badlogic.gdx.physics.box2d.World.<init>(World.java:101)
at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<init>(PhysicsWorld.java:61)
at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<init>(PhysicsWorld.java:57)

What can I do? 我能做什么?

I use this code from google discussion and it's working fine at my side. 我使用谷歌讨论中的代码,它在我身边工作正常。

import com.badlogic.gdx.utils.GdxNativesLoader;
GdxNativesLoader.load(); 

Use this before you do anything. 在做任何事之前使用它。 make sure you have gdx.jar and gdx-natives.jar in your project. 确保你的项目中有gdx.jargdx-natives.jar

如果在World属性声明期间分配实例,保留空声明并在App create()方法上分配新实例应该修复它,则会发生此错误。

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

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