hellocpp example crash

hellocpp example crash
0.0 0


my problem is that the HelloCpp example continue to crash on android, and i can’t figure out why, any help is really appreciated.

cocos2dx version: 2.2.1
NDK version: r9c

Unfortunately hellocpp has stopped. (on both emulator (host GPU enabled) and real device.
I tried android versions 2.2 (real), 2.3.3 (emul), 4.04 (real), 4.2.2 (emul))

COMPILE REPORT (unfortunately i’m on windows7 actually):

22:59:03 **** Incremental Build of configuration Default for project HelloCpp ****

bash C:/Users/Admin/Desktop/eclipse/workspace/HelloCpp/build_native.sh 
NDK_ROOT = C:\android-ndk-r9c
COCOS2DX_ROOT = /cygdrive/c/Cocos2D-X/2.2.1
APP_ROOT = /cygdrive/c/Users/Admin/Desktop/eclipse/workspace/HelloCpp/..
APP_ANDROID_ROOT = /cygdrive/c/Users/Admin/Desktop/eclipse/workspace/HelloCpp
Using prebuilt externals
+ 'C:\android-ndk-r9c/ndk-build' -C /cygdrive/c/Users/Admin/Desktop/eclipse/workspace/HelloCpp NDK_MODULE_PATH=/cygdrive/c/Cocos2D-X/2.2.1:/cygdrive/c/Cocos2D-X/2.2.1/cocos2dx/platform/third_party/android/prebuilt
make: Entering directory '/cygdrive/c/Users/Admin/Desktop/eclipse/workspace/HelloCpp'
Android NDK: WARNING:/cygdrive/c/Cocos2D-X/2.2.1/cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries    
[armeabi] Install        : libhellocpp.so => libs/armeabi/libhellocpp.so
make: Leaving directory '/cygdrive/c/Users/Admin/Desktop/eclipse/workspace/HelloCpp'

22:59:07 Build Finished (took 4s.189ms)


A/libc(1518): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 1531 (Thread-105)


Build fingerprint: 'generic/sdk/generic:4.4.2/KK/938007:eng/test-keys'
pid: 1518, tid: 1531, name: Thread-105  >>> org.cocos2dx.hellocpp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00  pc 0008b058  /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (HelloWorld::init()+335): Routine HelloWorld::init() at C:\Users\Admin\Desktop\eclipse\workspace\HelloCpp/jni/hellocpp/HelloWorldScene.cpp:72
Stack frame #01  pc 0008b113  /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (HelloWorld::create()+70): Routine HelloWorld::create() at C:\Users\Admin\Desktop\eclipse\workspace\HelloCpp/jni/hellocpp/HelloWorldScene.h:19 (discriminator 1)
Stack frame #02  pc 0008b13d  /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (HelloWorld::scene()+8): Routine HelloWorld::scene() at C:\Users\Admin\Desktop\eclipse\workspace\HelloCpp/jni/hellocpp/HelloWorldScene.cpp:12
Stack frame #03  pc 0008ad8d  /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (AppDelegate::applicationDidFinishLaunching()+308): Routine AppDelegate::applicationDidFinishLaunching() at C:\Users\Admin\Desktop\eclipse\workspace\HelloCpp/jni/hellocpp/AppDelegate.cpp:100
Stack frame #04  pc 000c212b  /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (cocos2d::CCApplication::run()+6): Routine cocos2d::CCApplication::run() at C:/Cocos2D-X/2.2.1/cocos2dx/platform/android/CCApplication.cpp:33
Stack frame #05  pc 0008a9f3  /data/app-lib/org.cocos2dx.hellocpp-1/libhellocpp.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+62): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit at C:\Users\Admin\Desktop\eclipse\workspace\HelloCpp/jni/hellocpp/main.cpp:31
Stack frame #06  pc 0001dbcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #07  pc 0004deff  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
Stack frame #08  pc 0003873d  /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+8)
Stack frame #09  pc 0004f8ed  /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+184)
Stack frame #10  pc 00026fe0  /system/lib/libdvm.so
Stack frame #11  pc 0002df34  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
Stack frame #12  pc 0002b5cc  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame #13  pc 00060319  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
Stack frame #14  pc 0006033d  /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #15  pc 0005502b  /system/lib/libdvm.so
Stack frame #16  pc 0000d060  /system/lib/libc.so (__thread_entry+72)
Stack frame #17  pc 0000d1f8  /system/lib/libc.so (pthread_create+240)


i created a new project with the python tool.
imported it.

after playing a bit, i got theese errors from logcat (both emulator and real device):

D/cocos2d-x debug info(842): Get data from file(closenormal.png) failed!
D/cocos2d-x debug info(842): Get data from file(closeselected.png) failed!
D/cocos2d-x debug info(842): Get data from file(helloworld.png) failed!
(and then the sigfault)

here’s my project res screenshot:



Looks like you are running in the wrong directory.


what directory do you mean?

i also noticed there’s no java file in the .apk, is it normal?

by the way, thank you for your reply, and sorry for my bad english


hi, i tried create a new project with the python tool in v2.2.1.
all are running ok in ios/android/win32.