FirebaseExtended / cocos2dx-cpp-sample

Firebase Cocos2d-x samples
http://firebase.google.com/games
MIT License
53 stars 25 forks source link

Crash on android 4.4.2 #5

Closed pbs0512 closed 7 years ago

pbs0512 commented 7 years ago

Device: Samsung Note2 SHV-E250S Android version: 4.4.2 cocos2d-x version: 3.14 NDK : r13b (64-bit) SDK : android-23

E/dalvikvm: dlopen("/data/app-lib/com.test.test-2/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=0x42315c08)
E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.test.test PID: 30141
                                                   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:5451)
                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
                                                       at android.app.ActivityThread.access$900(ActivityThread.java:175)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:146)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5602)
                                                       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)
pbs0512 commented 7 years ago

http://stackoverflow.com/questions/14571399/android-ndk-cant-find-atof-function I can see the link above and solve it. It like have to replace atof with std::atof in firebase c ++ lib.

formatCvt commented 7 years ago

hmm, looks like not a Firebase related issue. Can you please decrease platform version and test it again? example: cocos compile -p android --ap android-15 --android-studio --app-abi armeabi-v7a

pbs0512 commented 7 years ago

@formatCvt Oh thank you. I succeeded after lowering the sdk version (android-15). But the sample is android-22. Is need to lower sdk to support android 4.4? It is also run after the downgrade NDK 10b.

formatCvt commented 7 years ago

When i found this bug first time i just replace ap to 15 and forgot about this =) Definitely something wrong with cocos2d-x source code, i will try to figure out it. And yes, you should use ap < 21 until this bug fixed and doesn't matter using you Firebase or not.

pbs0512 commented 7 years ago

Thank you. Have a nice day :)

formatCvt commented 7 years ago

You're welcome =)

About this bug, looks like it should be fixed in Android NDK r15

https://android.googlesource.com/platform/ndk/+/master/docs/Roadmap.md

NDK r15 Fixed libandroid_support

As you are all well aware, early versions of Android were lacking a significant number of libc APIs. libc++ requires some APIs that were not available until android-21. To make libc++ available for all supported API levels, the NDK provides libandroid_support.