2012-06-10 49 views
5

每當我試圖在模擬器上執行的應用程序,仿真器顯示錯誤說:「不幸的是,我的libGDX遊戲已經停止。」儘管該應用程序在桌面版本上運行良好。Android模擬器沒有啓動LibGDX項目?

我有最新的nightly版本,ADT版本18,最新的GWT和Eclipse的最新版本。我的Android SDK工具是19版的,而我的Android SDK平臺的工具是版本11

關於如何解決此問題的任何想法?

我正沿着這個教程如下:LibGDX tutorial

這裏是我所看到的截圖:Emulator Screenshot

的logcat:

06-10 19:50:44.282: I/Process(1548): Sending signal. PID: 1548 SIG: 9 
06-10 19:50:48.022: I/dalvikvm(1566): threadid=3: reacting to signal 3 
06-10 19:50:48.152: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt' 
06-10 19:50:48.312: W/dalvikvm(1566): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/badlogic/gdx/backends/android/AndroidApplication; 
06-10 19:50:48.312: W/dalvikvm(1566): Class init failed in newInstance call (Lcom/me/mygdxgame/MainActivity;) 
06-10 19:50:48.322: D/AndroidRuntime(1566): Shutting down VM 
06-10 19:50:48.332: W/dalvikvm(1566): threadid=1: thread exiting with uncaught exception (group=0xb40d5180) 
06-10 19:50:48.392: E/AndroidRuntime(1566): FATAL EXCEPTION: main 
06-10 19:50:48.392: E/AndroidRuntime(1566): java.lang.ExceptionInInitializerError 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at java.lang.Class.newInstanceImpl(Native Method) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at java.lang.Class.newInstance(Class.java:1319) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.app.ActivityThread.access$600(ActivityThread.java:123) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.os.Handler.dispatchMessage(Handler.java:99) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.os.Looper.loop(Looper.java:137) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at android.app.ActivityThread.main(ActivityThread.java:4424) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at java.lang.reflect.Method.invokeNative(Native Method) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at java.lang.reflect.Method.invoke(Method.java:511) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at dalvik.system.NativeStart.main(Native Method) 
06-10 19:50:48.392: E/AndroidRuntime(1566): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gdx: findLibrary returned null 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at java.lang.Runtime.loadLibrary(Runtime.java:365) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at java.lang.System.loadLibrary(System.java:535) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:116) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  at com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication.java:59) 
06-10 19:50:48.392: E/AndroidRuntime(1566):  ... 15 more 
06-10 19:50:49.152: I/dalvikvm(1566): threadid=3: reacting to signal 3 
06-10 19:50:49.192: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt' 
06-10 19:50:49.972: I/dalvikvm(1566): threadid=3: reacting to signal 3 
06-10 19:50:50.012: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt' 
06-10 19:50:52.093: I/dalvikvm(1566): threadid=3: reacting to signal 3 
06-10 19:50:52.112: I/dalvikvm(1566): Wrote stack traces to '/data/anr/traces.txt' 

回答

14

如果這是一個基於ARM仿真器,你忘了將armeabi和armeabi-v7a文件夾添加到您的Android項目的庫/文件夾中。請在這裏按照安裝指南:http://code.google.com/p/libgdx/wiki/ProjectSetupNew

,如果這是一個基於x86模擬器,然後̶只怕̶t̶h̶e̶r̶e̶'̶s̶沒有辦法解決此問題̶y̶e̶t̶.̶我們不編譯Android的X86在̶m̶o̶m̶e̶n̶t̶.̶

Edit.- 86現在支持

+0

嗯,我當時正在使用Intel Atom(x86)... – BigBug

+1

只需注意x86現在支持,因爲Mario在本文中顯示: http://www.badlogicgames.com/wordpress/?p=3103 「要使用x86本機,只需將x86 /文件夾從nightlies複製到您的Android項目的libs /文件夾(在armeabi和armeabi- v7a文件夾)。setup-ui不會自動爲你添加這些庫。我選擇這樣做,因爲x86安卓設備是非常罕見的,你只是不必要地擴大了APK的大小。 「 – sam

0

如果沒有在設備上工作,要麼,試試這個: 機器人項目 - >屬性 - > Java構建路徑 - >在線訂單和出口 點擊你鏈接到項目(你的普通Java項目或桌面項目),然後單擊「向上」按鈕上,直到它是在最高層。確保它打勾[V]。 我這樣做,用的罐子太大,以防萬一,現在它運行我的設備上。我仍然在我的x86虛擬機上得到同樣的錯誤,因爲libgdx不支持x86 Android設備