Crash when run the CppTests in Eclipse

Hello all,

When I run the CppTests, it crashes and the logcat shows these errors.

Do you know what’s wrong?

05-02 21:29:10.280: E/AndroidRuntime(19264): FATAL EXCEPTION: main
05-02 21:29:10.280: E/AndroidRuntime(19264): java.lang.UnsatisfiedLinkError: Couldn't load cpp_tests from loader dalvik.system.PathClassLoader[dexPath=/mnt/asec/org.cocos2dx.cpp_tests-1/pkg.apk,libraryPath=/mnt/asec/org.cocos2dx.cpp_tests-1/lib]: findLibrary returned null
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at java.lang.Runtime.loadLibrary(Runtime.java:355)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at java.lang.System.loadLibrary(System.java:525)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:71)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.Activity.performCreate(Activity.java:5372)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.ActivityThread.access$700(ActivityThread.java:159)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.os.Handler.dispatchMessage(Handler.java:99)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.os.Looper.loop(Looper.java:176)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at android.app.ActivityThread.main(ActivityThread.java:5419)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at java.lang.reflect.Method.invokeNative(Native Method)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at java.lang.reflect.Method.invoke(Method.java:525)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
05-02 21:29:10.280: E/AndroidRuntime(19264): 	at dalvik.system.NativeStart.main(Native Method)

You need to compile C++ code by ‘build/android-build.py’ before run the project in eclipse.

Hi,
I know this is an old post but I am having the same issue and unfortunately i dont have “android-build.py” in the android project folder of cpp-empty-test. I am using Coco 3.13.1.

Can you please suggest any thing?

Thanks,
Abe

Hi @Abe_Fork,

Instead of android-build.py you can use Cocos Command.

http://cocos2d-x.org/docs/editors_and_tools/cocosCLTool/
http://www.cocos2d-x.org/wiki/Cocos2d-console

Hi @Gurudath

Thanks for your response. I tried compiling the cpp-empty-test with Cocos Command as

cocos compile -p android -m release

and it give the following errors:

Android NDK: ERROR:C:/Android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++/Andr
oid.mk:gnustl_static: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that C:/Android/android-ndk-r9d/sources/cxx-stl/gnu-libstdc++
/4.9/libs/armeabi/libgnustl_static.a exists  or that its path is correct

I looked into the path the 2nd error shows and I don’t have 4.9 folder in there. :frowning: only 4.6 and 4.8
Here are the tool versions I am using.

ADT: adt-bundle-windows-x86_64-20130917
NDK: android-ndk-r9d
Apache Ant: apache-ant-1.9.7
Cocos: cocos2d-x-3.13.1
Python: python-2.7.6.amd64
Installed JDKs: jdk-7u79-windows-x64 and jdk-8u111-windows-x64

Is there anything else I need to install?

Thanks,
Abe

@Abe_Fork,

Can you use Latest version of NDK & Check once.
Am using android-ndk-r10e Version. I have this file (sources/cxx-stl/gnu-libstdc++
/4.9/libs/armeabi/libgnustl_static.a) exists inside NDK.

Hi @Gurudath,

Thanks for the reply. I tried cocos 3.12 and it worked. But now I am having a hard time linking our own “.a” file for android.
But I am looking into it. Since it is not related to this topic, I am not willing to give a head ache for this issue here :slight_smile:

Thanks again.