问题
there are a few questions out there about this, however I cannot get any of their solutions to work. Everything I've tried has failed, does anyone know what I'm doing wrong?
Here is the error:
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
Here is my android launcher class:
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);
}
}
Here is a screenshot:
回答1:
I uninstall The application on the Android pad,then clean the project.and now I solve the problem "Class not found using the boot class loader; no stack trace available" just like you.
回答2:
Although reinstalling can solve the problem in some cases, if the problem persists try to restart the phone and reinstall the app.
回答3:
Uninstall the application from phone then run the code to install apk.
来源:https://stackoverflow.com/questions/38283765/class-not-found-using-the-boot-class-loader