cocos2Dx android test Crash

thank’s i’m going to do that.

what about my ndk r5 do the ndk r6 work ?

i rebuild everything with a new cocos2dx i can build the test.android but can’t run it crash when starting on the emulator.
the libs libchipmunk.so, libbox2d.so, libcocos2d.so and libtests.so. aren’t here.

i’m going to do other test on a apple mac osx to find if it’s not a problem with my cygwin.

ok i have reinstall my cygwin and the application build well ( maybe a missing file)

the lib are here assets to.
but the application stil crash.

Can you paste the crash point, or logcat / log from console? Is it the same as the 1st one you pasted?
I just re-build and run it again on mac, it works well. You’re facing a problem never reported by others, more informations would be helpful to locate it.

there is my logcat log(i’m working on windows 7).
thank you for your help

07-24 03:30:56.281: DEBUG/AndroidRuntime(375): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<

07-24 03:30:56.281: DEBUG/AndroidRuntime(375): CheckJNI is ON
07-24 03:30:57.011: DEBUG/AndroidRuntime(375): Calling main entry com.android.commands.pm.Pm
07-24 03:30:57.041: DEBUG/AndroidRuntime(375): Shutting down VM
07-24 03:30:57.061: DEBUG/dalvikvm(375): GC_CONCURRENT freed 101K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms
07-24 03:30:57.061: DEBUG/dalvikvm(375): Debugger has detached; object registry had 1 entries
07-24 03:30:57.091: INFO/AndroidRuntime(375): NOTE: attach of thread 'Binder Thread #3' failed
07-24 03:30:57.542: DEBUG/AndroidRuntime(385): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
07-24 03:30:57.542: DEBUG/AndroidRuntime(385): CheckJNI is ON
07-24 03:30:58.242: DEBUG/AndroidRuntime(385): Calling main entry com.android.commands.am.Am
07-24 03:30:58.272: INFO/ActivityManager(60): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.cocos2dx.tests/.TestsDemo } from pid 385
07-24 03:30:58.312: INFO/ActivityManager(60): Start proc org.cocos2dx.tests for activity org.cocos2dx.tests/.TestsDemo: pid=393 uid=10034 gids={3003, 1015}
07-24 03:30:58.352: DEBUG/AndroidRuntime(385): Shutting down VM
07-24 03:30:58.362: DEBUG/dalvikvm(385): GC_CONCURRENT freed 102K, 69% free 319K/1024K, external 0K/0K, paused 1ms+2ms
07-24 03:30:58.372: DEBUG/dalvikvm(385): Debugger has detached; object registry had 1 entries
07-24 03:30:58.432: INFO/AndroidRuntime(385): NOTE: attach of thread 'Binder Thread #3' failed
07-24 03:30:58.922: INFO/WindowManager(60): Setting rotation to 1, animFlags=1
07-24 03:30:58.922: INFO/ActivityManager(60): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=7}
07-24 03:30:59.343: DEBUG/dalvikvm(393): Trying to load lib /data/data/org.cocos2dx.tests/lib/libcocosdenshion.so 0x40515740
07-24 03:30:59.372: DEBUG/dalvikvm(393): Added shared lib /data/data/org.cocos2dx.tests/lib/libcocosdenshion.so 0x40515740
07-24 03:30:59.372: DEBUG/dalvikvm(393): Trying to load lib /data/data/org.cocos2dx.tests/lib/libchipmunk.so 0x40515740
07-24 03:30:59.392: DEBUG/dalvikvm(393): Added shared lib /data/data/org.cocos2dx.tests/lib/libchipmunk.so 0x40515740
07-24 03:30:59.392: DEBUG/dalvikvm(393): No JNI_OnLoad found in /data/data/org.cocos2dx.tests/lib/libchipmunk.so 0x40515740, skipping init
07-24 03:30:59.392: DEBUG/dalvikvm(393): Trying to load lib /data/data/org.cocos2dx.tests/lib/libbox2d.so 0x40515740
07-24 03:30:59.402: DEBUG/dalvikvm(393): Added shared lib /data/data/org.cocos2dx.tests/lib/libbox2d.so 0x40515740
07-24 03:30:59.402: DEBUG/dalvikvm(393): No JNI_OnLoad found in /data/data/org.cocos2dx.tests/lib/libbox2d.so 0x40515740, skipping init
07-24 03:30:59.402: DEBUG/dalvikvm(393): Trying to load lib /data/data/org.cocos2dx.tests/lib/libcocos2d.so 0x40515740
07-24 03:30:59.492: DEBUG/dalvikvm(393): Added shared lib /data/data/org.cocos2dx.tests/lib/libcocos2d.so 0x40515740
07-24 03:30:59.492: WARN/dalvikvm(393): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/cocos2dx/tests/TestsDemo;
07-24 03:30:59.492: WARN/dalvikvm(393): Class init failed in newInstance call (Lorg/cocos2dx/tests/TestsDemo;)
07-24 03:30:59.492: DEBUG/AndroidRuntime(393): Shutting down VM
07-24 03:30:59.502: WARN/dalvikvm(393): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-24 03:30:59.532: ERROR/AndroidRuntime(393): FATAL EXCEPTION: main
07-24 03:30:59.532: ERROR/AndroidRuntime(393): java.lang.ExceptionInInitializerError
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at java.lang.Class.newInstanceImpl(Native Method)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at java.lang.Class.newInstance(Class.java:1409)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.os.Looper.loop(Looper.java:123)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at android.app.ActivityThread.main(ActivityThread.java:3683)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at java.lang.reflect.Method.invokeNative(Native Method)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at java.lang.reflect.Method.invoke(Method.java:507)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at dalvik.system.NativeStart.main(Native Method)
07-24 03:30:59.532: ERROR/AndroidRuntime(393): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load tests: findLibrary returned null
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at java.lang.Runtime.loadLibrary(Runtime.java:429)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at java.lang.System.loadLibrary(System.java:554)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     at org.cocos2dx.tests.TestsDemo.(TestsDemo.java:53)
07-24 03:30:59.532: ERROR/AndroidRuntime(393):     ... 15 more
07-24 03:30:59.622: WARN/ActivityManager(60):   Force finishing activity org.cocos2dx.tests/.TestsDemo
07-24 03:30:59.913: DEBUG/dalvikvm(60): GC_EXTERNAL_ALLOC freed 259K, 52% free 4261K/8775K, external 3897K/3903K, paused 85ms
07-24 03:31:00.163: WARN/ActivityManager(60): Activity pause timeout for HistoryRecord{407bf178 org.cocos2dx.tests/.TestsDemo}
07-24 03:31:00.332: DEBUG/dalvikvm(60): GC_EXPLICIT freed 65K, 53% free 4211K/8775K, external 3906K/4878K, paused 90ms
07-24 03:31:00.342: INFO/WindowManager(60): Setting rotation to 0, animFlags=1
07-24 03:31:00.352: INFO/ActivityManager(60): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=8}
07-24 03:31:03.032: DEBUG/dalvikvm(60): GC_EXPLICIT freed 12K, 53% free 4208K/8775K, external 3511K/4385K, paused 88ms
07-24 03:31:10.991: WARN/ActivityManager(60): Activity destroy timeout for HistoryRecord{407bf178 org.cocos2dx.tests/.TestsDemo}
07-24 03:31:14.975: DEBUG/SntpClient(60): request time failed: java.net.SocketException: Address family not supported by protocol
07-24 03:31:59.261: INFO/Process(393): Sending signal. PID: 393 SIG: 9
07-24 03:31:59.271: INFO/ActivityManager(60): Process org.cocos2dx.tests (pid 393) has died.
07-24 03:31:59.321: WARN/InputManagerService(60): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40626c90

OK. Ming, it’s your time now :slight_smile:

It failed at loading libtest.so. Have libtest.so builded ok?

libtest.so isn’t in the lib directory and on the apb lib directory

on my test/android.mk the test lib isn’t include i guess

LOCAL_LDLIBS := -L$(call host-path, $(LOCAL_PATH)/../../libs/armeabi) \

                -lGLESv1_CM \
                -lcocos2d -llog -lcocosdenshion \
                -lbox2d -lchipmunk \
                -L$(call host-path, $(LOCAL_PATH)/../../../../cocos2dx/platform/third_party/android/libraries) -lcurl

include $(BUILD_SHARED_LIBRARY)

do i have to include the /tests directory ?

No, the LOCAL_LDLIBS defines what you want to link to build for libtest.so.
Please paste your tests/test.android/jni/Android.mk.

after a long pausing time i finnaly find the answer in the forum

my problems was

1 the write permission on the libstlport_static.a & libwchar_static.a so the libs can’t compile well and crash the application ( the compilator throw an error before so it’s a good clue).

2 compile of but the Box2d libs aren’t find by the application thanks to this tutorial [[http://gameit.ro/2011/08/creating-a-cocos2d-x-box2d-android-project/]] i find that i just have to add the box2d lib on the .java file.

thanks to the cocos2d-x comunity

Congratulation.

Hope you getting more help from the community, and giving help to people who need.

i get this error in my log cat while running in emulator . i use windows 7 and ndk is 6