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

1

6

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?

Rutilant answered 4/12, 2012 at 12:8 Comment(4)
test your app on a real device might be betterIcebreaker
I want to test my app on emulator to test how my app works on different screens.Rutilant
couldn't help much then, actually our company bought a lot devices in deferent resolution.....Icebreaker
I solved this, see my answerRutilant
R
9

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

Rutilant answered 5/12, 2012 at 9:31 Comment(1)
Yes, this! I spent hours trying to track down the problem. The BasicGLSurfaceViewActivity SDK sample would not work on the emulator on Windows. Adding your call to setEGLConfigChooser before setRenderer in the BasicGLSurfaceView constructor fixed it. I'd give you more upvotes if I could!Carabin

© 2022 - 2024 — McMap. All rights reserved.