سؤال

i'm developing a android game which uses libgdx and bullet physics engine. I can compile the game without any problems, but when i add bullet to the game it crashes with this error:

.... UnsatisfiedLinkError: Couldn't load bullet: findLibrary returned null ...

I can compile the bullet library just fine but when i try to use it in my code it crashes.. The funny thing is that i have another project that uses bullet but without libgdx and it works without any problems. Does any one know what could be the problem? From what i know ndk-build generates only .so files and obj folder.

It looks like the bullet .so file isn't included in the .apk, thus the crash. How could i check if it is? Did anyone had any similar problems?

Thanks for the help!

هل كانت مفيدة؟

المحلول

i've solved my problem. The problem was that libgdx has armeabi and armeabi-v7a folders in libs folder and bullet has only armeabi. So i've removed the armeabi-v7a and it magicly worked!

نصائح أخرى

Check that name that is passed to System.loadLibrary is same as .so name in your .apk file. Apk file actually is a zip file - so you can rename it to .zip extension, unzip and examine libs folder inside.

So if you have file named libFooBar.so under libs folder in apk file, then you should pass one of following names to loadLibary - "FooBar", "libFooBar" or "libFooBar.so".

I had this issue show up when I started using .cpp native files instead of .c native files. The problem was that I wasn't accounting for name-mangling in the .cpp build tools. Try adding the following surrounding your native method definitions:

#ifdef __cplusplus 
extern "C" {
#endif
    /* ... */
#ifdef __cplusplus
}
#endif

im having a similar problem

the above post were helpfull though, I checked my game.apk and the so library is under lib/armeabi, but when i build it in eclipse its in libs/armeabi.

i think it should be under libs normally and if anybody can help me change lib to libs when building will be really helpfull.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top