Sometimes, when sending the app to the background and resuming it, Cocos2dxActivity’s onCreate method is called. This causes cocos_android_app_init to be called, and this triggers an assert in CCApplication-android.cpp. ( CCAssert(! sm_pSharedApplication, “”) )
I think this is because it tries to initialize everything again, without having exited the application.
After this happens, I get a bunch of gl_errors and the applications becomes unusable:
04-23 19:38:50.465: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.465: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.465: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.465: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.465: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.471: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.471: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.471: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.471: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.476: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.476: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.476: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.476: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.492: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
04-23 19:38:50.492: W/Adreno-ES20(31595): <gl_draw_error_checks:614>: GL_INVALID_OPERATION
04-23 19:38:50.492: D/cocos2d-x debug info(31595): OpenGL error 0x0502 in /Users/andres/Documents/Projects/MetroMon/frameworks/runtime-src/proj.android/…/…/cocos2d-x/cocos/./renderer/CCTextureAtlas.cpp drawNumberOfQuads 693
Does anyone have any idea how to fix this?
I’m using cocos v3.3