Cocos2d-x crash on android ndk r10c / r10d

Hi, I was using ndk r9 and it was working without any problem, but I tested my app on nexus 7 with android 5.0 and found very strange issues (disappearing randomly textures, just on the start, sometimes they were appearing for a while and disappearing again). I found that it’s an issue with android 5.0 and I should use android ndk r10. I tried both r10c and r10d and both gave me the same results (tested first on android 4.4 btw):

03-03 00:56:16.245: E/dalvikvm(20584): dlopen("/data/app-lib/com.example.test-2/libcocos2dcpp.so") failed: dlopen failed: cannot locate symbol “rand” referenced by “libcocos2dcpp.so”…
03-03 00:56:16.265: E/AndroidRuntime(20584): FATAL EXCEPTION: main
03-03 00:56:16.265: E/AndroidRuntime(20584): Process: com.example.test, PID: 20584
03-03 00:56:16.265: E/AndroidRuntime(20584): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol “rand” referenced by “libcocos2dcpp.so”…
03-03 00:56:16.265: E/AndroidRuntime(20584): at java.lang.Runtime.loadLibrary(Runtime.java:364)
03-03 00:56:16.265: E/AndroidRuntime(20584): at java.lang.System.loadLibrary(System.java:526)
03-03 00:56:16.265: E/AndroidRuntime(20584): at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:207)
03-03 00:56:16.265: E/AndroidRuntime(20584): at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:222)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.Activity.performCreate(Activity.java:5231)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.ActivityThread.access$800(ActivityThread.java:144)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.os.Handler.dispatchMessage(Handler.java:102)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.os.Looper.loop(Looper.java:136)
03-03 00:56:16.265: E/AndroidRuntime(20584): at android.app.ActivityThread.main(ActivityThread.java:5146)
03-03 00:56:16.265: E/AndroidRuntime(20584): at java.lang.reflect.Method.invokeNative(Native Method)
03-03 00:56:16.265: E/AndroidRuntime(20584): at java.lang.reflect.Method.invoke(Method.java:515)
03-03 00:56:16.265: E/AndroidRuntime(20584): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
03-03 00:56:16.265: E/AndroidRuntime(20584): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
03-03 00:56:16.265: E/AndroidRuntime(20584): at dalvik.system.NativeStart.main(Native Method)

I’ve found this topic: http://discuss.cocos2d-x.org/t/build-android-base-on-ndk-r10c/18543 but I’m not getting any compilation errors.
As you can see it compiles but crashes on startup.
I’m using cocos2d-x 3.4 on mac os x yosemite 64bit. Latest android sdk and as I said ndk r10c/10d. On r9 it’s working exept android 5.0 (no crash, but strange issues).

edit:
and by the way the “missing” file is present in libs/armeabi directory.

Well thanks it’s not crashing anymore, but still on android 5.0 I see mostly white screen. Well I figured out that if I’d hide a scrollview with bitmap Label::createWithBMFont it works…

It’s also happening when using masks (clippingNode)… Help!

edit:

Ok I’ve run tests on android 5.0 and it’s not a problem with createWithBMFont. It’s a problem with masks and scrollview (which uses masks too, so it looks like it’s the same) in my case.

Cpp tests -> Node: Clipping

Android 4.4:

Android 5.0:

Sorry, for hijacking your thread, but it seems impossible to create a new topic.

I can’t even get to the point, where cocos2d-x is compiling successfully for Android.
I’am getting this linker error:

Applications/Cocos/frameworks/cocos2d-x-3.4rc1/cocos/editor-support/cocostudio/prebuilt-mk/../../../../prebuilt/android/x86/libcocostudio.a(CCActionManagerEx.o):function cocostudio::ActionManagerEx::getActionByName(char const*, char const*): error: undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
/Applications/Cocos/frameworks/cocos2d-x-3.4rc1/cocos/editor-support/cocostudio/prebuilt-mk/../../../../prebuilt/android/x86/libcocostudio.a(CCActionManagerEx.o):function cocostudio::ActionManagerEx::initWithDictionary(char const*, rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > const&, cocos2d::Ref*): error: undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
/Applications/Cocos/frameworks/cocos2d-x-3.4rc1/cocos/editor-support/cocostudio/prebuilt-mk/../../../../prebuilt/android/x86/libcocostudio.a(CCActionManagerEx.o):function cocostudio::ActionManagerEx::initWithBinary(char const*, cocos2d::Ref*, cocostudio::CocoLoader*, cocostudio::stExpCocoNode*): error: undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
/Applications/Cocos/frameworks/cocos2d-x-3.4rc1/cocos/editor-support/cocostudio/prebuilt-mk/../../../../prebuilt/android/x86/libcocostudio.a(CCActionNode.o):function cocostudio::ActionNode::updateActionToTimeLine(float): error: undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/x86/libcocos2dcpp.so] Error 1

Have you switched from other ndk? Project->clean does not really clean in eclipse… To force py script to build all files I removed all files in bin, gen and obj dirs.