Android崩溃提示 “EGL_BAD_CONFIG"

时间:2022-03-05 18:55:09

这两天将之前提到的一个室内定位程序的ArcGIS的SDK从10.2.8迁移到100.1.0.

期间反复出现奇怪的问题,最终定位到这个问题:

java.lang.RuntimeException: createContext failed: EGL_BAD_CONFIG
                                                                                        at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1233)
                                                                                        at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1224)
                                                                                        at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1074)
                                                                                        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1447)
                                                                                        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1286)

看起来是OpenGL,花了我一整天的时间也没搞定。

最后看到GeoNet上有人问了一个问题,他的问题描述为:

06-14 11:12:11.699 8073-8101/? E/AndroidRuntime: FATAL EXCEPTION: GLThread 332  
               java.lang.RuntimeException: createContext failed: EGL_SUCCESS 
               at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1197)
               at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1188) 
               at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1038) 
               at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1405) 
               at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1244)06-14 11:12:18.039 8136-8167/? 
E/fb4a(:<default>):MmsConfig: MmsConfig.loadMmsSettings mms_config.xml missing uaProfUrl setting

虽然问题不同(EGL_SUCCESS,EGL_BAD_CONFIG),看到了官方回复:

This is a known issue for this release that has not found its way into the release notes yet, we will update the release notes soon.

The issue is that some devices do not correctly report their OpenGL configurations to allow us to create our OpenGL context. We need to be specific in creating the OpenGL context to allow many of our map rendering features to work properly (particularly for things like Vector Tiled Layers). We have implemented a solution which works on most devices, but it will still be problematic on some, especially older devices running older versions of Android.

大意是说,他们这个版本的API还有问题,因为部分设备不报告OpenGL的配置信息给他们使用导致的问题,他们会很快修复。

所以我赶紧换了台设备测试,这下正常了。

 

然而。。。。一年过去了,他们还没更新API解决这个问题!!!

所以需要稳定可靠的童鞋还是用10.2.8的老版本吧,虽然他们不会再支持了。