2013-08-26 9 views
11

Io uso cocos2d-x per sviluppare un gioco, dopo che è stato eseguito perfettamente in iOs, mi giro sulla piattaforma Android.Come controllare il registro degli arresti anomali usando android ndk in cocos2d-x

Ma correre da qualche parte in Android, e ho solo ricevere alcuni log di errore come questo:

08-26 10:49:23.823: A/libc(2884): Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 2917 (Thread-285) 

Con questo, non riesco a risolvere il crash log.

Quindi la mia domanda è: come posso controllare lo stack del registro degli arresti anomali?

E in SO, ci sono alcune domande simili, ma senza nessuna risposta utile a me.

Using ndk-stack to read crash logs

Unable to get line no from stack trace in android ndk

How to get Useful crashlog information Android Cocos2dx C++

+0

passare attraverso lo stesso errore ... il mio codice cocos2d-x corre così bene ... ma lo stesso codice dà questo errore –

risposta

28

trovo la risposta perfetta a http://www.cocos2d-x.org/boards/6/topics/20437.

La soluzione è:

Quando si ottiene gli errori come questo sul LogCat, essi vengono salvati sul $PROJECT_PATH/obj/local/armeabi dove $PROJECT_PATH è il percorso del cocos2d-x progetto Android. Per simbolizzare i messaggi con qualcosa di comprensibile, puoi usare lo strumento ndk-stack.

aprire il Terminale (o Cygwin, non è sicuro però) e digitare

cd $ANDROID_NDK 
adb logcat | ./ndk-stack -sym $PROJECT_PATH/obj/local/armeabi 

dove:

$ANDROID_NDK è il percorso del Android NDK

$PROJECT_PATH è il percorso progetto android cocos2d-x


E ho provato, e ottenere il seguente stack-trace:

********** Crash dump: ********** 
Build fingerprint: 'google/soju/crespo:4.1.2/JZO54K/485486:user/release-keys' 
pid: 2884, tid: 2917, name: Thread-285 >>> com.gumichina.allen <<< 
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000000c 
Stack frame #00 pc 0062bfb4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCObject::release()+20): Routine release in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:82 
Stack frame #01 pc 006d8094 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchHandler::~CCTouchHandler()+128): Routine ~CCTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:108 
Stack frame #02 pc 006d8524 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTargetedTouchHandler::~CCTargetedTouchHandler()+84): Routine ~CCTargetedTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:193 
Stack frame #03 pc 006d8570 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTargetedTouchHandler::~CCTargetedTouchHandler()+20): Routine ~CCTargetedTouchHandler in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchHandler.cpp:193 
Stack frame #04 pc 0062bff4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCObject::release()+84): Routine release in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCObject.cpp:86 
Stack frame #05 pc 006aade4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::ccArrayRemoveObjectAtIndex(cocos2d::_ccArray*, unsigned int, bool)+100): Routine ccArrayRemoveObjectAtIndex in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/support/data_support/ccCArray.cpp:197 
Stack frame #06 pc 006aafa0 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::ccArrayRemoveObject(cocos2d::_ccArray*, cocos2d::CCObject*, bool)+72): Routine ccArrayRemoveObject in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/support/data_support/ccCArray.cpp:235 
Stack frame #07 pc 0062fed4 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCArray::removeObject(cocos2d::CCObject*, bool)+52): Routine removeObject in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/cocoa/CCArray.cpp:295 
Stack frame #08 pc 006d6c90 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::forceRemoveDelegate(cocos2d::CCTouchDelegate*)+500): Routine forceRemoveDelegate in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:200 
Stack frame #09 pc 006d7888 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::touches(cocos2d::CCSet*, cocos2d::CCEvent*, unsigned int)+1620): Routine touches in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:449 
Stack frame #10 pc 006d7b74 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCTouchDispatcher::touchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*)+56): Routine touchesEnded in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/touch_dispatcher/CCTouchDispatcher.cpp:507 
Stack frame #11 pc 0068acb8 /mnt/asec/com.gumichina.allen-2/lib/liballen.so (cocos2d::CCEGLViewProtocol::handleTouchesEnd(int, int*, float*, float*)+124): Routine handleTouchesEnd in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/platform/CCEGLViewProtocol.cpp:333 
Stack frame #12 pc 0069340c /mnt/asec/com.gumichina.allen-2/lib/liballen.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd+88): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd in /Users/tangyue/project/crosskaiser-native/application/proj.android/../../cocos2dx/platform/android/jni/TouchesJni.cpp:42 
Stack frame #13 pc 0001de30 /system/lib/libdvm.so (dvmPlatformInvoke+112) 
Stack frame #14 pc 0004ce73 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+390) 
Stack frame #15 pc 0004ef8f /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+174) 
Stack frame #16 pc 00027260 /system/lib/libdvm.so 
Stack frame #17 pc 0002bb38 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180) 
Stack frame #18 pc 0005f5b1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272) 
Stack frame #19 pc 0005f5db /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20) 
Stack frame #20 pc 00054193 /system/lib/libdvm.so 
Stack frame #21 pc 00012b90 /system/lib/libc.so (__thread_entry+48): Unable to open symbol file obj/local/armeabi//libc.so. Error (9): Bad file descriptor 
Stack frame #22 pc 000122f4 /system/lib/libc.so (pthread_create+172): Unable to open symbol file obj/local/armeabi//libc.so. Error (9): Bad file descriptor 
+0

Srinivass-MacBook-PRO : proj.android SrinivasJ $ cd/Utenti/SrinivasJ/android-ndk-r9 Srinivass-MacBook-PRO: android-ndk-r9 SrinivasJ $ adb logcat | ./ndk-stack -sym $ PROJECT_PATH/obj/local/armeabi -bash: adb: comando non trovato provo a controllare come dicevi .... ma adom coomand non trovato errore ottenendo ... is i nee dto caricare NDK o SDK – Sri

+0

Ho anche provato questa soluzione, ma adb non è stata trovata su questa directory –

+0

@FilipeFerminiano @Sri dovresti aggiungere il percorso sdk di Android dove adb è nel tuo sistema 'PATH'. Per me, è in '$ ANDROID_SDK/platform-tools' – pktangyue