Cannot locate symbol "rand" - ndk-r10d android-21

Cannot locate symbol "rand" - ndk-r10d android-21


I have below error when starting cpp-tests:
dlopen("/mnt/asec/org.cocos2dx.cpp_tests-1/lib/") failed: dlopen failed: cannot locate symbol “rand” referenced by “”

cocos2dx-3.3, ndk-r10d, android-21
cpp-tests was compiler with cocos compile -android

How to fix it properly?
I read something about new C library in Android-L.


what compiler?

Choose android-19 and it will work.
Do you really need android-21? Because if you do, you’re going to have trouble getting it working on Android 5.0 AND Android 4.x and lower…

The NDK platform target should equals to your minSdkVersion

Thank you for answer.

android-19 fixed issue.
cocos compile -android --ap 19

Will cocos2dx work on Android 5.0 with --ap 19?


Yes, it works perfect here on Android 5 and all lower versions :slight_smile:


I got similar problem. I’m using ndk-r10e and Android api 22, on Windows environment.
My question is whether there is a workaround without forcing me to switch to api 19?