libgdx问题 - 不幸的是,my-gdx游戏已停止

时间:2014-07-21 14:09:30

标签: java android libgdx

我可以让my-gdx-game-desktop java应用程序运行没有问题,但似乎无法让my-gdx-game-android工作。

我的AVD上收到了“不幸的是,my-gdx游戏停止了”的消息。

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

很抱歉,如果这是一个愚蠢的问题,我正在做一些非常愚蠢的事情。你可能会说我是新手编码,所以任何帮助都表示赞赏!

2 个答案:

答案 0 :(得分:1)

似乎Android API 19模拟器存在错误。如果我在API-19中运行libgdx OpenGL ES 2.0应用程序,我会得到相同的例外:

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

解决方法是使用另一个具有较低API级别但仍具有OpenGL ES 2.0的仿真器,但没有这个烦人的错误。 测试的一个很好的选择是具有API 17的Galaxy Nexus仿真器。对我来说,同样的libgdx OpenGL ES 2.0应用程序在那里运行良好。你应该试一试。

答案 1 :(得分:0)

  

07-21 10:01:00.359:D / libEGL(791):未检测到GPU支持的仿真器。回退到软件渲染器。

开启&#34;仿真器选项是必要的:使用主机GPU&#34;