This is happening to me sometimes too.
Here is the crash dump
********** Crash dump: **********
Build fingerprint: 'samsung/jfltexx/jflte:4.4.2/KOT49H/I9505XXUFNC4:user/release-keys'
pid: 19589, tid: 19658, name: Thread-23257 >>> org.cocos2dx.hellocpp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00 pc 008bafe8 /data/app-lib/org.cocos2dx.hellocpp-31/libInteractiveBookReader.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause+48): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnPause at <proj_path>/jni/../../cocos2d/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp:19
Stack frame #01 pc 00020bcc /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #02 pc 00051927 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
Stack frame #03 pc 000535d1 /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+256)
Stack frame #04 pc 0002a060 /system/lib/libdvm.so
Stack frame #05 pc 00031510 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
Stack frame #06 pc 0002eba8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame #07 pc 00063e75 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
Stack frame #08 pc 00063e99 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #09 pc 00058b6b /system/lib/libdvm.so
Stack frame #10 pc 0000d278 /system/lib/libc.so (__thread_entry+72): Routine ??
??:0
Stack frame #11 pc 0000d410 /system/lib/libc.so (pthread_create+240): Routine ??
??:0
So as we can see Cocos2dxRenderer.nativeOnPause is being called before Cocos2dxRenderer.nativeInit. This is a really weird behaviour from Android but can be easily prevented by checking in nativeInit has been called before calling nativeOnPause
So, check http://stackoverflow.com/questions/7345282/why-the-onpause-method-is-called-immediately-after-oncreate.
There is a very strong possibility of OnPause being called before onSurfaceCreated due to stupid ActivityManager behaviours.
Since I use my own custom renderer (Cocos2dxRenderer subclass) this is what I ended up doing
public class MyRenderer extends Cocos2dxRenderer {
private boolean bNativeInitCompleted = false;
@Override
public void handleOnPause() {
if(!bNativeInitCompleted) return;
super.handleOnPause();
}
@Override
public void onSurfaceCreated(GL10 pGL10, EGLConfig pEGLConfig) {
super.onSurfaceCreated(pGL10, pEGLConfig);
bNativeInitCompleted = true;
}
}