在项目运行过程中,在手机上运行会出现闪退的现象, 报告错误代码如下:
06-30 10:45:19.921: E/cocos2d-x assert(28033): E:/workspace/cocos2d-x-2.2.2/projects/****/proj.android/../../../cocos2dx/platform/android/CCApplication.cpp function:sharedApplication line:60
06-30 10:45:19.921: A/libc(28033): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 28062 (Thread-3117)
解决方案:
需要修改如下目录下的文件:
cocos2dx\platform\android\jni\Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp
修改过程:CCApplication::sharedApplication()->applicationDidEnterBackground();
修改成:
if (CCDirector::sharedDirector()->getOpenGLView()) {
CCApplication::sharedApplication()->applicationDidEnterBackground();
}