Skip to content

Commit 56ae741

Browse files
James Chenminggo
authored andcommitted
fixed #17665: [android] Crash while launching on the devices only support OpenGL ES 2. (#17671)
* fixed #17665: [android] Crash while launching on the devices only support OpenGL ES 2. Fixes that egl.eglCreateContext may return non-null but EGL10.EGL_NO_CONTEXT value. It will cause create a EGL env with a EGL_NO_CONTEXT egl context which will cause crash. * Don’t link with libGLESv1_CM.so
1 parent 21f51f0 commit 56ae741

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

cocos/platform/android/Android.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
2727
$(LOCAL_PATH)/.. \
2828
$(LOCAL_PATH)/../.. \
2929

30-
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM \
31-
-lGLESv2 \
30+
LOCAL_EXPORT_LDLIBS := -lGLESv2 \
3231
-lEGL \
3332
-llog \
3433
-landroid

cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public EGLContext createContext(
405405
EGLContext context = egl.eglCreateContext(
406406
display, eglConfig, EGL10.EGL_NO_CONTEXT, attributes);
407407

408-
if (context == null) {
408+
if (context == null || EGL10.EGL_NO_CONTEXT == context) {
409409
attributes = new int[] {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
410410
context = egl.eglCreateContext(
411411
display, eglConfig, EGL10.EGL_NO_CONTEXT, attributes);

0 commit comments

Comments
 (0)