user3355817
user3355817

Reputation: 121

libgdx issue - unfortunately, my-gdx-game has stopped

I can get the my-gdx-game-desktop java application running no problems but can't seem to get my-gdx-game-android to work.

I receive the message 'unfortunately, my-gdx-game has stopped' on my AVD.

Logcat:

07-21 10:00:59.509: D/dalvikvm(791): Not late-enabling CheckJNI (already on)
07-21 10:01:00.289: D/dalvikvm(791): Trying to load lib /data/app-lib/com.mygdx.game.android-2/libgdx.so 0x416e54c0
07-21 10:01:00.310: D/dalvikvm(791): Added shared lib /data/app-lib/com.mygdx.game.android-2/libgdx.so 0x416e54c0
07-21 10:01:00.319: D/dalvikvm(791): No JNI_OnLoad found in /data/app-lib/com.mygdx.game.android-2/libgdx.so 0x416e54c0, skipping init
07-21 10:01:00.359: D/libEGL(791): Emulator without GPU support detected. Fallback to software renderer.
07-21 10:01:00.429: D/libEGL(791): loaded /system/lib/egl/libGLES_android.so
07-21 10:01:00.489: D/AndroidRuntime(791): Shutting down VM
07-21 10:01:00.509: W/dalvikvm(791): threadid=1: thread exiting with uncaught exception 
(group=0x41465700)
07-21 10:01:00.539: E/AndroidRuntime(791): FATAL EXCEPTION: main
07-21 10:01:00.539: E/AndroidRuntime(791): java.lang.RuntimeException: Unable to start 
activity ComponentInfo{com.mygdx.game.android/com.mygdx.game.android.AndroidLauncher}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-21 10:01:00.539: E/AndroidRuntime(791):  at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.os.Looper.loop(Looper.java:137)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.ActivityThread.main(ActivityThread.java:5103)
07-21 10:01:00.539: E/AndroidRuntime(791):  at java.lang.reflect.Method.invokeNative(Native Method)
07-21 10:01:00.539: E/AndroidRuntime(791):  at 
java.lang.reflect.Method.invoke(Method.java:525)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-21 10:01:00.539: E/AndroidRuntime(791):  at dalvik.system.NativeStart.main(Native Method)
07-21 10:01:00.539: E/AndroidRuntime(791): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.badlogic.gdx.backends.android.AndroidGraphics.createGLSurfaceView(AndroidGraphics.java:121)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:101)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:94)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.badlogic.gdx.backends.android.AndroidApplication.init(AndroidApplication.java:130)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.badlogic.gdx.backends.android.AndroidApplication.initialize(AndroidApplication.java:96)
07-21 10:01:00.539: E/AndroidRuntime(791):  at com.mygdx.game.android.AndroidLauncher.onCreate(AndroidLauncher.java:14)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.Activity.performCreate(Activity.java:5133)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-21 10:01:00.539: E/AndroidRuntime(791):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
07-21 10:01:00.539: E/AndroidRuntime(791):  ... 11 more

Sorry if this is a stupid question and I'm doing something incredibly dumb. As you can probably tell I'm new to coding so any help is appreciated!

Upvotes: 1

Views: 1920

Answers (2)

mikowiec
mikowiec

Reputation: 501

07-21 10:01:00.359: D/libEGL(791): Emulator without GPU support detected. Fallback to software renderer.

It's neccessary to switch on "Emulator options: Use Host GPU"

Upvotes: 0

donfuxx
donfuxx

Reputation: 11323

It seems like there is a bug with the Android API 19 emulator. If I run a libgdx OpenGL ES 2.0 app in API-19 I get the same exception:

E/AndroidRuntime(791): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: 
Libgdx requires OpenGL ES 2.0

The workaround is to use another emulator with an a little bit lower API level that still has OpenGL ES 2.0, but doesn't have this annoying bug. A good choice for testing would be the Galaxy Nexus Emulator with API 17 for example. For me the same libgdx OpenGL ES 2.0 app worked fine there. You should give this a try.

Upvotes: 1

Related Questions