A Sample Bug (Touch Event for android)

As I know cocos2d-x do like this:
Activity starts > onCreate> onStart > onResume> init CCEGLView -> init AppDelegate

so when it calls onResume ,it can be touched.
If you touch at that time , it will call jni to do :

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
    cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y);
}

but it will case crash !
because CCDirector::sharedDirector()->setOpenGLView(CCEGLView *pobOpenGLView) is called in " init AppDelegate " after the touch ,
so CCDirector::sharedDirector()->getOpenGLView() will return NULL!

so I think this cocos2dx\platform\android\jni\TouchesJni.cpp should be modified.
like this:

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
    if(cocos2d::CCDirector::sharedDirector()->getOpenGLView())
        cocos2d::CCDirector::sharedDirector()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y);
}

Did it work for you, @waiter ? I have the same issue in my app, but it only appears on production app. I can’t reproduce it. But I believe from what you said that this is a potential solution, I’m not sure.