The problem is in createContext ( Cocos2dxActiviti.java )
if the context fails to initialize egl.eglCreateContext( … ) will NOT return a NULL pointer. The return will be EGL10.EGL_NO_CONTEXT witch is a valid pointer. The application will crash later because the valid context was not created.
This is a possible fix for this issue:
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
// create GL ES 3 context first,
// if failed, then try to create GL ES 2 context
int[] attributes = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL10.EGL_NONE };
// attempt to create a OpenGL ES 3.0 context
EGLContext context = egl.eglCreateContext(
display, eglConfig, EGL10.EGL_NO_CONTEXT, attributes);
if (context == EGL10.EGL_NO_CONTEXT) {
attributes = new int[] {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
context = egl.eglCreateContext(
display, eglConfig, EGL10.EGL_NO_CONTEXT, attributes);
}
if (context == EGL10.EGL_NO_CONTEXT) {
Log.e(DEVICE_POLICY_SERVICE, "Unable to create eagl context!");
}
return context;
}