當我運行我的項目時,它立即崩潰並輸出。我創建了一個新的新項目,但它也崩潰了。我使用Eclipse,因爲我非常喜歡它。LibGDX Android應用程序在啓動時崩潰
03-31 22:26:35.896: E/AndroidRuntime(17299): FATAL EXCEPTION: main
03-31 22:26:35.896: E/AndroidRuntime(17299): Process: se.wiklund.memblock, PID: 17299
03-31 22:26:35.896: E/AndroidRuntime(17299): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{se.wiklund.memblock/se.wiklund.memblock.AndroidLauncher}: java.lang.ClassNotFoundException: Didn't find class "se.wiklund.memblock.AndroidLauncher" on path: DexPathList[[zip file "/data/app/se.wiklund.memblock-1/base.apk"],nativeLibraryDirectories=[/data/app/se.wiklund.memblock-1/lib/arm64, /data/app/se.wiklund.memblock-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2373)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2522)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.ActivityThread.access$900(ActivityThread.java:154)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1389)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.os.Handler.dispatchMessage(Handler.java:102)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.os.Looper.loop(Looper.java:224)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.ActivityThread.main(ActivityThread.java:5514)
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.reflect.Method.invoke(Native Method)
03-31 22:26:35.896: E/AndroidRuntime(17299): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
03-31 22:26:35.896: E/AndroidRuntime(17299): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-31 22:26:35.896: E/AndroidRuntime(17299): Caused by: java.lang.ClassNotFoundException: Didn't find class "se.wiklund.memblock.AndroidLauncher" on path: DexPathList[[zip file "/data/app/se.wiklund.memblock-1/base.apk"],nativeLibraryDirectories=[/data/app/se.wiklund.memblock-1/lib/arm64, /data/app/se.wiklund.memblock-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
03-31 22:26:35.896: E/AndroidRuntime(17299): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
03-31 22:26:35.896: E/AndroidRuntime(17299): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2363)
03-31 22:26:35.896: E/AndroidRuntime(17299): ... 9 more
03-31 22:26:35.896: E/AndroidRuntime(17299): Suppressed: java.lang.NoClassDefFoundError: se.wiklund.memblock.AndroidLauncher
03-31 22:26:35.896: E/AndroidRuntime(17299): at dalvik.system.DexFile.defineClassNative(Native Method)
03-31 22:26:35.896: E/AndroidRuntime(17299): at dalvik.system.DexFile.defineClass(DexFile.java:226)
03-31 22:26:35.896: E/AndroidRuntime(17299): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
03-31 22:26:35.896: E/AndroidRuntime(17299): at dalvik.system.DexPathList.findClass(DexPathList.java:338)
03-31 22:26:35.896: E/AndroidRuntime(17299): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
03-31 22:26:35.896: E/AndroidRuntime(17299): ... 13 more
03-31 22:26:35.896: E/AndroidRuntime(17299): Suppressed: java.lang.ClassNotFoundException: se.wiklund.memblock.AndroidLauncher
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.Class.classForName(Native Method)
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
03-31 22:26:35.896: E/AndroidRuntime(17299): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
03-31 22:26:35.896: E/AndroidRuntime(17299): ... 12 more
03-31 22:26:35.896: E/AndroidRuntime(17299): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
編輯:它可以在Android Studio中很好,所以它必須是一些與Eclipse。但如果可能的話,我真的想堅持使用Eclipse。
您的libgdx項目是用Gradle製作的嗎?您可以使用Eclipse,但我強烈建議您也使用Gradle進行構建。 – Logain
嘗試清理所有項目 –
FWIW,我試圖掛在Eclipse上的時間比我應該多一年。我每週都遇到像上面這樣的問題。切換到Android Studio/IDEA後,它們完全是過去的事情。我已經使用IDEA兩年了,只能在Eclipse中使用。花一天時間才能習慣新的界面。我還發現,由於IDEA中的一些快捷鍵(例如,鍵入「fori TAB」),我可以更快地編寫代碼。 – Tenfour04