BUG: createWindowSurface failed EGL_BAD_ALLOC

我只是一个虾纸丫 提交于 2019-12-03 10:40:43

问题


I have an application on Google Play for counting down numbers and letters. In this application I have the following activities:

  • google sigin
  • archivements
  • admob service

I use Google Analytics, and ACRA for error reporting. I don't use GLsurfaceView, but I use ACRA one or two times a day which gives me these errors:

java.lang.RuntimeException: createWindowSurface failed EGL_BAD_ALLOC
at android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:763)
at android.view.HardwareRenderer$GlRenderer.createEglSurface(HardwareRenderer.java:663)
at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:502)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1325)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2467)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

Does anyone know what happened? I don't use surfaceView; can anyone help me?


回答1:


I had the same issue and found that the problem is related to WebView(s) and hardware acceleration on some devices.

Instead of turning off completely hardware acceleration, I disabled it for all my WebView(s) including the AdMob view!

Here how to do it:

adView = new AdView(this); //or get it with findViewById()
if (Build.VERSION.SDK_INT >= 11) {
   adView.setLayerType(AdView.LAYER_TYPE_SOFTWARE, null); //instead of LAYER_TYPE_HARDWARE
}



回答2:


Have you tried disabling hardware acceleration for your app (it's utilizing OpenGL hence the hunch for this fix)?

Adding

<application android:hardwareAccelerated="false" ...>

To application tag in the manifest would explicitly turn it off. And perhaps the issue will go away.

See this question with answers if you want to know: if should use hardware acceleration or not



来源:https://stackoverflow.com/questions/20152890/bug-createwindowsurface-failed-egl-bad-alloc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!