(eclipse中的libGDX android)无法实例化活动ComponentInfo [英] (libGDX android in eclipse) unable to instantiate activity ComponentInfo

查看:86
本文介绍了(eclipse中的libGDX android)无法实例化活动ComponentInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始进行Android游戏开发,却遇到了一个愚蠢的问题.我想在手机或虚拟机上运行应用程序,但出现此错误:

I just started Android Game Development and I ran into a stupid problem. I want to run an application on my phone or virtual machine and I'm getting this error:

01-11 21:16:45.362: E/AndroidRuntime(19063): FATAL EXCEPTION: main
01-11 21:16:45.362: E/AndroidRuntime(19063): Process: com.mygdx.game, PID: 19063
01-11 21:16:45.362: E/AndroidRuntime(19063): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mygdx.game/com.mygdx.game.AndroidLauncher}: java.lang.ClassNotFoundException: Didn't find class "com.mygdx.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.mygdx.game-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mygdx.game-1/lib/arm, /vendor/lib, /system/lib]]
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2515)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2723)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.ActivityThread.access$900(ActivityThread.java:172)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1422)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.os.Handler.dispatchMessage(Handler.java:102)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.os.Looper.loop(Looper.java:145)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.ActivityThread.main(ActivityThread.java:5832)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at java.lang.reflect.Method.invoke(Native Method)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at java.lang.reflect.Method.invoke(Method.java:372)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
01-11 21:16:45.362: E/AndroidRuntime(19063): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mygdx.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.mygdx.game-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mygdx.game-1/lib/arm, /vendor/lib, /system/lib]]
01-11 21:16:45.362: E/AndroidRuntime(19063):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
01-11 21:16:45.362: E/AndroidRuntime(19063):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2505)
01-11 21:16:45.362: E/AndroidRuntime(19063):    ... 10 more
01-11 21:16:45.362: E/AndroidRuntime(19063):    Suppressed: java.lang.NoClassDefFoundError: com.mygdx.game.AndroidLauncher
01-11 21:16:45.362: E/AndroidRuntime(19063):        at dalvik.system.DexFile.defineClassNative(Native Method)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at dalvik.system.DexFile.defineClass(DexFile.java:226)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at dalvik.system.DexPathList.findClass(DexPathList.java:321)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
01-11 21:16:45.362: E/AndroidRuntime(19063):        ... 14 more
01-11 21:16:45.362: E/AndroidRuntime(19063):    Suppressed: java.lang.ClassNotFoundException: com.mygdx.game.AndroidLauncher
01-11 21:16:45.362: E/AndroidRuntime(19063):        at java.lang.Class.classForName(Native Method)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
01-11 21:16:45.362: E/AndroidRuntime(19063):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
01-11 21:16:45.362: E/AndroidRuntime(19063):        ... 13 more
01-11 21:16:45.362: E/AndroidRuntime(19063):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

如果您有经验,请帮助我.祝你有美好的一天.

If you have experienced it, please help me. Have a nice day.

推荐答案

右键单击android项目,然后单击属性-> Java Build Path-> Order and Export,然后在所有框中打勾.

Right click on the android project and click properties -> Java Build Path -> Order and Export, and tick all the boxes.

清理项目并重建.

从eclipse中的其他android API切换时出现错误.

The error comes when switching from different android API's in eclipse.

通常,当您没有默认的Android SDK(我没有的是我的19)时,这通常会在新的libGDX项目上发生,该项目由Project-> properties-> Android修复,然后选择构建目标.

Also usually this happens on a new libGDX project when you don't have the default Android SDK (mine was 19 which I don't have), which is fixed by Project -> properties -> Android, and select the build target.

进行这些更改后,请始终清除项目.

Always clean the project after making these changes.

以上两个问题是我在libGDX和Eclipse中经常遇到的问题,无论是在导入项目,只是设置一个新项目还是在重新安装Android SDK时.

The above two issues are ones I am always coming across with libGDX and Eclipse, either when importing a project, just setting a new one up or when I'm reinstalling Android SDK's.

希望这会有所帮助. ;-)

Hope this helps. ;-)

这篇关于(eclipse中的libGDX android)无法实例化活动ComponentInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆