2014-05-01 85 views
2

這是我第一次使用libgdx,我想嘗試在設置gdx-setup-ui後提供的默認應用程序。它運行正常,當我打在日食運行按鈕,它已表現出libgdx android啓動失敗

[2014-05-01 21:40:14 - my-gdx-game-android] Uploading my-gdx-game-android.apk onto device 'emulator-5554' 
[2014-05-01 21:40:15 - my-gdx-game-android] Installing my-gdx-game-android.apk... 
[2014-05-01 21:40:16 - my-gdx-game-android] Success! 
[2014-05-01 21:40:16 - my-gdx-game-android] Starting activity com.me.mygdxgame.MainActivity on device emulator-5554 
[2014-05-01 21:40:16 - my-gdx-game-android] ActivityManager: WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix. 
[2014-05-01 21:40:16 - my-gdx-game-android] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.me.mygdxgame/.MainActivity } 

但在模擬器上它說不幸的是,我的LibGDX遊戲已經停止。

這些都顯示在logcat中:

05-01 17:02:04.936: D/dalvikvm(2034): Trying to load lib /data/app-lib/com.me.mygdxgame-1/libgdx.so 0xb103cb78 
05-01 17:02:04.936: D/dalvikvm(2034): Added shared lib /data/app-lib/com.me.mygdxgame-1/libgdx.so 0xb103cb78 
05-01 17:02:04.936: D/dalvikvm(2034): No JNI_OnLoad found in /data/app-lib/com.me.mygdxgame-1/libgdx.so 0xb103cb78, skipping init 
05-01 17:02:04.936: D/AndroidRuntime(2034): Shutting down VM 
05-01 17:02:04.936: W/dalvikvm(2034): threadid=1: thread exiting with uncaught exception (group=0xb0d34b20) 
05-01 17:02:04.996: E/AndroidRuntime(2034): FATAL EXCEPTION: main 
05-01 17:02:04.996: E/AndroidRuntime(2034): Process: com.me.mygdxgame, PID: 2034 
05-01 17:02:04.996: E/AndroidRuntime(2034): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.me.mygdxgame/com.me.mygdxgame.MainActivity}: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.ActivityThread.access$800(ActivityThread.java:135) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.os.Handler.dispatchMessage(Handler.java:102) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.os.Looper.loop(Looper.java:136) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.ActivityThread.main(ActivityThread.java:5017) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at java.lang.reflect.Method.invokeNative(Native Method) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at java.lang.reflect.Method.invoke(Method.java:515) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at dalvik.system.NativeStart.main(Native Method) 
05-01 17:02:04.996: E/AndroidRuntime(2034): Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Libgdx requires OpenGL ES 2.0 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.badlogic.gdx.backends.android.AndroidGraphics.createGLSurfaceView(AndroidGraphics.java:121) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:101) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.badlogic.gdx.backends.android.AndroidGraphics.<init>(AndroidGraphics.java:94) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.badlogic.gdx.backends.android.AndroidApplication.init(AndroidApplication.java:130) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.badlogic.gdx.backends.android.AndroidApplication.initialize(AndroidApplication.java:96) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at com.me.mygdxgame.MainActivity.onCreate(MainActivity.java:15) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.Activity.performCreate(Activity.java:5231) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) 
05-01 17:02:04.996: E/AndroidRuntime(2034):  ... 11 more 

另外,我刪除了行cfg.useGL20 = true;MainActivity.java,因爲它不斷給我的錯誤,我試圖快速修復它,這是行不通的。我真的需要它在模擬器中使用,因爲我沒有在android設備上擁有它。

+1

我認爲Android模擬器不支持OpenGL ES 2.0,並且LibGDX不支持自1.0版以來的 Phonbopit

+1

可能重複[LibGDX Hello-World Project不起作用](http://stackoverflow.com/questions/22703940/libgdx-hello-world-project-does-not-work) –

+0

哦,我的上帝,genymotion對我來說工作得很好!感謝您的回覆:D – SourCreamOnion

回答

5

我能夠使在MacBook Air上這項工作:

  1. 打開Android虛擬設備管理器(在Eclipse 例如,這是在Window菜單下)
  2. 點擊編輯的設備你想在出現的對話框與
  3. 工作勾選「使用主機GPU」,如圖

Click Use Host GPU

保存並重試。

我猜這取決於您的計算機的顯卡支持OpenGL2.0,但我也懷疑這是現在很常見。