简体   繁体   中英

Android app using libGDX crashes

I don't know what to do. I let libGDX setup an Eclipse project for Desktop and for Android and then tried to launch it on my Android tablet(I don't use an avd because it's awfully slow). Immediately after it installed the apk it tries to launch it and then the app crashes. I haven't modified any code of the project. It seems that when I launch the app on my Android device it can't find a class. Maybe someone can tell me what I have to do from the LogCat output.

06-02 02:07:27.430: W/dalvikvm(17018): Unable to resolve superclass of   Lcom/test/game/AndroidLauncher; (3)
06-02 02:07:27.430: W/dalvikvm(17018): Link of class 'Lcom/test/game/AndroidLauncher;' failed
06-02 02:07:27.430: D/AndroidRuntime(17018): Shutting down VM
06-02 02:07:27.430: W/dalvikvm(17018): threadid=1: thread exiting with uncaught exception (group=0x415edba8)
06-02 02:07:27.430: E/AndroidRuntime(17018): FATAL EXCEPTION: main
06-02 02:07:27.430: E/AndroidRuntime(17018): Process: com.test.game, PID: 17018
06-02 02:07:27.430: E/AndroidRuntime(17018): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.test.game/com.test.game.AndroidLauncher}: java.lang.ClassNotFoundException: Didn't find class "com.test.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.test.game-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.test.game-1, /vendor/lib, /system/lib]]
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.os.Handler.dispatchMessage(Handler.java:102)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.os.Looper.loop(Looper.java:136)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.ActivityThread.main(ActivityThread.java:5017)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at java.lang.reflect.Method.invokeNative(Native Method)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at java.lang.reflect.Method.invoke(Method.java:515)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:813)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at dalvik.system.NativeStart.main(Native Method)
06-02 02:07:27.430: E/AndroidRuntime(17018): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.test.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.test.game-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.test.game-1, /vendor/lib, /system/lib]]
06-02 02:07:27.430: E/AndroidRuntime(17018):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
06-02 02:07:27.430: E/AndroidRuntime(17018):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
06-02 02:07:27.430: E/AndroidRuntime(17018):    ... 11 more

If anyone here knows what's going wrong, I would be glad if they could help.

Have you copied all the native files like files with .so extension or other. Without this, your project will not run. Some classes must be dependent on that native files.

Are you using external Jars? These need to be in a libs (exactly written) folder or there classes will not be "dexed". If you are not using gradle to import the jar in your project you need to add it manually to include it in the build.

Android - Unable to resolve superclass

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM