Reputation: 611
I am trying to build my first Hello World Cocos2D project. I am using NDK r10e and already imported the library.
First got this error while trying to build with Android 22, then switched to Android 19 as advised in previous questions, but it didn't solve. I get the following logcat:
07-13 16:04:30.416: E/AndroidRuntime(26892): FATAL EXCEPTION: main
07-13 16:04:30.416: E/AndroidRuntime(26892): Process: com.danielemolinari.HelloWorld, PID: 26892
07-13 16:04:30.416: E/AndroidRuntime(26892): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "srand" referenced by "libcocos2dcpp.so"...
07-13 16:04:30.416: E/AndroidRuntime(26892): at java.lang.Runtime.loadLibrary(Runtime.java:365)
07-13 16:04:30.416: E/AndroidRuntime(26892): at java.lang.System.loadLibrary(System.java:526)
07-13 16:04:30.416: E/AndroidRuntime(26892): at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:207)
07-13 16:04:30.416: E/AndroidRuntime(26892): at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:222)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.Activity.performCreate(Activity.java:5451)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.ActivityThread.access$900(ActivityThread.java:175)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.os.Handler.dispatchMessage(Handler.java:102)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.os.Looper.loop(Looper.java:146)
07-13 16:04:30.416: E/AndroidRuntime(26892): at android.app.ActivityThread.main(ActivityThread.java:5602)
07-13 16:04:30.416: E/AndroidRuntime(26892): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 16:04:30.416: E/AndroidRuntime(26892): at java.lang.reflect.Method.invoke(Method.java:515)
07-13 16:04:30.416: E/AndroidRuntime(26892): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
07-13 16:04:30.416: E/AndroidRuntime(26892): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
07-13 16:04:30.416: E/AndroidRuntime(26892): at dalvik.system.NativeStart.main(Native Method)
Any advice?
Upvotes: 1
Views: 1606
Reputation: 83
Comment to the answer that recommends to install an earlier version of the SDK:
There's no need. You needed to change neither the toolchain (NDK r9d instead of the latest and greatest -at the time of this writing, r10e) nor the target (API 19 instead of the latest and greatest -nowadays API 23).
It was enough with adding, to your app Application.mk, the following:
APP_PLATFORM := android-<n> # where n is your target API
APP_ABI := <your target platforms, like armeabi-v7a, x86, etc.>
The reality is that the latest platform releases of the NDK and the SDK contain improved versions of the earlier ones, if you downgrade the SDK (or the NDK), you're putting a ceiling to your own platform maturity, and you don't need to do that while featuring backward compatibility.
Upvotes: 0
Reputation: 611
EDIT: SOLVED To solve the error:
It will work on any Android device, even on Lollipop.
Upvotes: 1