Cannot locate symbol "atof" referenced by "libMyGame.so"

Error when run my game after compile it for android and run on Android 4.4.2:

cocos compile -p android --ap android-22 --android-studio

Everything works fine on Android 5+.

10/05 14:08:13: Launching FlyForCoins
$ adb push /Users/paulo/Developer/workspaces/cpp/FlyForCoins/proj.android-studio/app/build/outputs/apk/FlyForCoins-debug.apk /data/local/tmp/com.prsolucoes.flyforcoins
$ adb shell pm install -r "/data/local/tmp/com.prsolucoes.flyforcoins"
	pkg: /data/local/tmp/com.prsolucoes.flyforcoins
Success


$ adb shell am start -n "com.prsolucoes.flyforcoins/org.cocos2dx.cpp.AppActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.prsolucoes.flyforcoins.test | com.prsolucoes.flyforcoins
Connecting to com.prsolucoes.flyforcoins
W/ActivityThread: Application com.prsolucoes.flyforcoins is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/dalvikvm: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:8601', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1427)
I/PersonaManager: getPersonaService() name persona_policy
D/dalvikvm: Trying to load lib /data/app-lib/com.prsolucoes.flyforcoins-3/libMyGame.so 0x4250f1f0
E/dalvikvm: dlopen("/data/app-lib/com.prsolucoes.flyforcoins-3/libMyGame.so") failed: dlopen failed: cannot locate symbol "atof" referenced by "libMyGame.so"...
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41d9dda0)
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.prsolucoes.flyforcoins, PID: 15413
                  java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libMyGame.so"...
                      at java.lang.Runtime.loadLibrary(Runtime.java:365)
                      at java.lang.System.loadLibrary(System.java:526)
                      at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
                      at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
                      at android.app.Activity.performCreate(Activity.java:5458)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2470)
                      at android.app.ActivityThread.access$900(ActivityThread.java:174)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1307)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:146)
                      at android.app.ActivityThread.main(ActivityThread.java:5593)
                      at java.lang.reflect.Method.invokeNative(Native Method)
                      at java.lang.reflect.Method.invoke(Method.java:515)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                      at dalvik.system.NativeStart.main(Native Method)
Disconnected from the target VM, address: 'localhost:8601', transport: 'socket'


might help

1 Like

Hi,

Thanks, problems solved:

We need add on Application.mk the line:

APP_PLATFORM := android-9

Recompiling it, works.

1 Like

Thank you! this problem created lots of crashes for android 4 users.