2.2.6, java.lang.UnsatisfiedLinkError cocos2dcpp

Cocos2d-x 2.2.6
NDK r10d

When my app tries to call this line of code:

System.loadLibrary("cocos2dcpp");

It crashes with this error

    FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1883)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1314]: 108 cannot locate 'atof'...
at java.lang.Runtime.loadLibrary(Runtime.java:370)
at java.lang.System.loadLibrary(System.java:535)
at com.ds223.testapp.TestApp.<clinit>(TestApp.java:192)

I have tried a number of this including cleaning the project and running build_native.sh

The project is run from eclipse

The libs\armeabi folder does contain:
libcocos2dcpp.so

Thanks in advance

I have even tried adding this to the AndroidManifest.xml

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

Information from:

This also did not make any difference.

I have the same error, any update on that?

Hi, you should look at this stackoverflow post = https://stackoverflow.com/questions/27338318/cannot-load-library-reloc-library1285-cannot-locate-rand
It says " This happens if you’ve built your native components with the android-21 target, but are trying to run it on a device with an older Android version. Unless you take very special care, you can’t run binaries built with the android-21 target on older devices. For basic C functions, it shouldn’t matter which target version between android-3 and android-20 you use, it should work on all of them, but if you use android-21 it only works on that version and newer."
Hope this will help
Good luck !

1 Like