glo
glo

Reputation: 1428

UnsatisfiedLinkError: Couldn't load cocos2dcpp: findLibrary returned null

We have been getting a lot of crash reports on google play with the following crash log :

java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1409)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1572)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1674)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3733)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:931)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:689)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load cocos2dcpp: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:429)
at java.lang.System.loadLibrary(System.java:554)
at com.xx.xxx.xxxx.<clinit>(xxxx.java:173)
... 15 more

This error only happens for devices with android version 2.3.3-2.3.7. This seems to be a common problem but no one has a solution. Has anyone solved this issue.

Some of the links reporting this problem are :

http://www.cocos2d-x.org/forums/6/topics/45833

http://www.cocos2d-x.org/forums/6/topics/42570

Thanks in advance.

Upvotes: 2

Views: 8870

Answers (3)

Jacky Kim
Jacky Kim

Reputation: 41

Couldn't load cocos2dcpp

this is the main application's name. "libcocos2dcpp.so"

you can find this in AndroidManifest.xml

<!-- Tell Cocos2dxActivity the name of our .so -->
    <meta-data android:name="android.app.lib_name"
              android:value="cocos2dcpp" />

also, in proj.android/jni/Android.mk

LOCAL_MODULE_FILENAME := libcocos2dcpp

i guess you changed the module name in Android.mk

Upvotes: 4

AtwoodYen
AtwoodYen

Reputation: 31

cocos2d-x 's third-party library only support armeabi armeabi-v7a & x86, but default only armeabi, when you add some other library to your project, they may build for not just armeabi, so when you link your project, system may fail to load cocos2dcpp.lib. to solve the problem, just see the new library you add support what kind's abi and add in your application.mk, like..

APP_ABI:=armeabi armeabi-v7a x86

clean and re-build again.

Upvotes: 3

Ankit Bisht
Ankit Bisht

Reputation: 1269

This error occurs only when your project does not get the referenced libraries... Did you compile your project with build_native.sh/build_native.py first, before running from eclipse

Upvotes: 1

Related Questions