cocos2d-x v 2.0.4 FATAL EXCEPTION GLThread when run on Android emulator

Petr picture Petr · Dec 4, 2012 · Viewed 9k times · Source

I create cocos2d-x app I'm using cocos2d-2.0-x-2.0.4 I've got error when trying to run app from Eclipse on Android emulator.

12-04 08:03:13.792: E/AndroidRuntime(1081): FATAL EXCEPTION: GLThread 105
12-04 08:03:13.792: E/AndroidRuntime(1081): java.lang.IllegalArgumentException: No config chosen
12-04 08:03:13.792: E/AndroidRuntime(1081): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:874)
12-04 08:03:13.792: E/AndroidRuntime(1081): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
12-04 08:03:13.792: E/AndroidRuntime(1081): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
12-04 08:03:13.792: E/AndroidRuntime(1081): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

I set

<uses-feature android:glEsVersion="0x00020000" android:required="true" /> 

in manifest. I turned on gpu emulation for AVD. I use API level 17 for AVD I found discussion about that problem on cocos2d-x forum: http://www.cocos2d-x.org/boards/6/topics/12563 I have tried everything mentioned there without success. What is a reason of that problem? How can I fix it?

Answer

Petr picture Petr · Dec 5, 2012

I solved this rpoblem by adding

gLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);

before

gLSurfaceView.setCocos2dxRenderer(new Cocos2dxRenderer());

in Cocos2dxActivity.java

Now my app runs on emulator.

My post on this link contains screenshot with AVD settings:

http://www.cocos2d-x.org/boards/6/topics/12563?r=19274#message-19274