51

I am trying to run a simple OpenGL program in Android. I am running this in an Android 4.1 emulator. I switched on its GPU emulation and it worked fine yesterday. When I ran that today, initially it was hanging saying, OpenGL taking time to render - Wait or Close dialog box. After few runs again it was crashing saying

E/EGL_emulation(2637): Failed to establish connection with the host

followed by

11-30 11:48:10.787: E/AndroidRuntime(2637): FATAL EXCEPTION: main
11-30 11:48:10.787: E/AndroidRuntime(2637): java.lang.IllegalArgumentException: eglChooseConfig failed EGL_NOT_INITIALIZED
11-30 11:48:10.787: E/AndroidRuntime(2637):     at android.view.HardwareRenderer$GlRenderer.chooseEglConfig(HardwareRenderer.java:852)
11-30 11:48:10.787: E/AndroidRuntime(2637):     at android.view.HardwareRenderer$GlRenderer.initializeEgl(HardwareRenderer.java:804)
11-30 11:48:10.787: E/AndroidRuntime(2637):     at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:747)
11-30 11:48:10.787: E/AndroidRuntime(2637):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1505)
11-30 11:48:10.787: E/AndroidRuntime(2637):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
11-30 11:48:10.787: E/AndroidRuntime(2637):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)

I guess the emulator is not able to take control of the GPU of the system, so how do I avoid this error? How do I rectify this problem?

Thanks in advance. :)

mmBs
  • 8,421
  • 6
  • 38
  • 46
Chaitanya
  • 3,399
  • 6
  • 29
  • 47
  • 30
    Oh!.. a simple restart of the emulator solved the problem for me. :) – Chaitanya Nov 30 '12 at 06:42
  • 1
    What the hell? Same problem and definitely didn't solve it for me. – michaelsnowden Nov 15 '13 at 10:43
  • 6
    I had this problem in the Genymotion emulator, running android 4.3. I just closed and restarted the emulator, and it worked... – IgorGanapolsky Dec 09 '13 at 15:51
  • 1
    Restarting the Genymotion emulator solved it for me too. – Andrew Arnott Dec 24 '13 at 15:41
  • 2
    Couple of times it happened to me as well and it didn't turn up good even after several times of restarts. I had to delete that particular emulator, recreate it afresh then bang-on...it worked :) – Ramakishna Balla Dec 30 '13 at 18:53
  • This isn't really a solution but I had a lot of problems testing my OpenGL apps on the emulator. Even ones worked fine when I ran them on the same physical device it was supposed to be emulating. I would recommend just getting a physical device to run OpenGL apps on. – ebeilmann Feb 14 '14 at 04:59

2 Answers2

63

This happens to me when my computer came out standby. Restart your virtual device.

Defuera
  • 5,356
  • 3
  • 32
  • 38
14

I was having the same problem in my Genymotion emulator while running a webview based application,I have restarted the emulator and it worked fine

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
Sid
  • 691
  • 6
  • 9
  • 7
    This doesn't seem to be an answer to the question and also it's been mentioned in the comments. – Ean V Feb 13 '14 at 23:14
  • For me, the exact solution crashed Genymotion on to different computers, so it came from the code, not from the simulator, even if restarting it can help. – Léon Pelletier Mar 19 '14 at 01:14