使用引导类加载器找不到的类

时间:2016-07-09 16:12:51

标签: java android android-activity libgdx android-manifest

有一些关于此的问题,但是我无法让他们的任何解决方案起作用。我尝试过的一切都失败了,有谁知道我做错了什么?

这是错误:

07-09 12:05:20.772 17337-17337/com.spaceshooter.game E/AndroidRuntime: FATAL EXCEPTION: main
                                                                       Process: com.spaceshooter.game, PID: 17337
                                                                       java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.spaceshooter.game/com.spaceshooter.game.AndroidLauncher}: java.lang.ClassNotFoundException: Didn't find class "com.spaceshooter.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.spaceshooter.game-2/base.apk"],nativeLibraryDirectories=[/data/app/com.spaceshooter.game-2/lib/arm, /data/app/com.spaceshooter.game-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3093)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                                           at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                           at android.os.Looper.loop(Looper.java:158)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:7225)
                                                                           at java.lang.reflect.Method.invoke(Native Method)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                                        Caused by: java.lang.ClassNotFoundException: Didn't find class "com.spaceshooter.game.AndroidLauncher" on path: DexPathList[[zip file "/data/app/com.spaceshooter.game-2/base.apk"],nativeLibraryDirectories=[/data/app/com.spaceshooter.game-2/lib/arm, /data/app/com.spaceshooter.game-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
                                                                           at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                           at android.app.Instrumentation.newActivity(Instrumentation.java:1095)
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3083)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349) 
                                                                           at android.app.ActivityThread.access$1100(ActivityThread.java:221) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                           at android.os.Looper.loop(Looper.java:158) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:7225) 
                                                                           at java.lang.reflect.Method.invoke(Native Method) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
                                                                        Suppressed: java.lang.ClassNotFoundException: com.spaceshooter.game.AndroidLauncher
                                                                           at java.lang.Class.classForName(Native Method)
                                                                           at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                           at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                           at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                                ... 12 more
                                                                        Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

这是我的android启动器类:

package com.spaceshooter.game;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.spencergang.game.SSGame;

public class AndroidLauncher extends AndroidApplication {
    @Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
        config.useAccelerometer = true;
        config.useCompass = true;
        initialize(new SSGame(), config);
    }
}

以下是截图:

Screenshot

3 个答案:

答案 0 :(得分:3)

我在Android平板电脑上卸载应用程序,然后清理项目。现在我解决了这个问题 “使用引导类加载器找不到类;没有可用的堆栈跟踪” 就像你一样。

答案 1 :(得分:1)

虽然重新安装可以在某些情况下解决问题,但如果问题仍然存在,请尝试重新启动手机并重新安装该应用。

答案 2 :(得分:0)

从手机上卸载应用程序,然后运行代码安装apk。