java.lang.ClassNotFoundException: Didn't find class "xxx" on path: DexPathList

重构项目第一天就碰到AS的大坑,google各种搜,终于在STACK OVERFLOW找到了答案,原来是INSTALL RUN的锅,当你碰到以下bug时候,就这样设置下:

java.lang.ClassNotFoundException: Didn't find class
1.png
java.lang.ClassNotFoundException: Didn't find class
2.png

把第二张图的对勾全部取消就ok了

如图:


java.lang.ClassNotFoundException: Didn't find class
3.png

但我项目碰到的是找不到application,其实都是一个原因。

E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.example.administrator.myapplication, PID: 32630
                                                   java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.administrator.myapplication/com.example.administrator.myapplication.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.administrator.myapplication.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.administrator.myapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.administrator.myapplication-1/lib/arm64, /system/lib64, /vendor/lib64]]
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2721)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2880)
                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1617)
                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                       at android.os.Looper.loop(Looper.java:185)
                                                       at android.app.ActivityThread.main(ActivityThread.java:6493)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:916)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806)
                                                    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.administrator.myapplication.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.administrator.myapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.administrator.myapplication-1/lib/arm64, /system/lib64, /vendor/lib64]]
                                                       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                                                       at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                       at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2711)
                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2880) 
                                                       at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1617) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                       at android.os.Looper.loop(Looper.java:185) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:6493) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:916) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806) 

你可能感兴趣的:(java.lang.ClassNotFoundException: Didn't find class "xxx" on path: DexPathList)