Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BUG: createWindowSurface failed EGL_BAD_ALLOC

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?

like image 740
cayrodev Avatar asked Nov 22 '13 19:11

cayrodev


2 Answers

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
}
like image 173
agirardello Avatar answered Oct 24 '22 11:10

agirardello


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

like image 43
Magnus Avatar answered Oct 24 '22 10:10

Magnus