BUG: createWindowSurface failed EGL_BAD_ALLOC

cayrodev picture cayrodev · Nov 22, 2013 · Viewed 9.6k times · Source

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?

Answer

agirardello picture agirardello · Jan 25, 2015

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
}