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

Hi,

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

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.

Regards,
Mariusz

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?

Regards,
Mariusz

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

Hello,

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?