简体   繁体   English

使用libGDX的Android应用崩溃

[英]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). 我让libGDX为Desktop和Android设置了一个Eclipse项目,然后尝试在我的Android平板电脑上启动它(我不使用avd,因为它的运行速度非常慢)。 Immediately after it installed the apk it tries to launch it and then the app crashes. 安装APK后,它立即尝试启动它,然后应用崩溃。 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. 看来,当我在Android设备上启动该应用程序时,它找不到课程。 Maybe someone can tell me what I have to do from the LogCat output. 也许有人可以告诉我LogCat输出中我该怎么做。

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. 您是否复制了所有本机文件,例如扩展名为.so或其他文件的文件。 Without this, your project will not run. 否则,您的项目将无法运行。 Some classes must be dependent on that native files. 有些类必须依赖于该本地文件。

Are you using external Jars? 您在使用外部Jars吗? These need to be in a libs (exactly written) folder or there classes will not be "dexed". 这些文件必须放在libs (完全写好的)文件夹中,否则将不会“删除”类。 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. 如果您不使用gradle将jar导入项目中,则需要手动添加它以将其包含在构建中。

Android - Unable to resolve superclass Android-无法解析超类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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