android 调试崩溃Unable to instantiate application的解决方法
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.***.plants, PID:
23100
java.lang.RuntimeException: Unable to instantiate application com.***.MyApplication: java.lang.ClassNotFoundException: Didn't find
class
"com.****.MyApplication"
on path: DexPathList[[zip file
"/data/app/com.****.plants-1/base.apk"
],nativeLibraryDirectories=[/data/app/com.***.plants-
1
/lib/arm64, /system/fake-libs64, /data/app/com.***.plants-
1
/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:
853
)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:
5681
)
***
Caused by: java.lang.ClassNotFoundException: Didn't find
class
"com.***.MyApplication"
on path: DexPathList[[zip file
"/data/app/com.****.plants-1/base.apk"
],nativeLibraryDirectories=[/data/app/com.***.plants-
1
/lib/arm64, /system/fake-libs64, /data/app/com.***.plants-
1
/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
***
解决方法:
打开设置:file->settings,搜索Instant Run,取消勾选Enable?Instant Run to***如图:
关于Instant Run:是Android Studio2.0之后更新的一个强大的功能!在第一次运行之后,修改后的代码UI等不需要再build!可以快速再在真机上看到效果!节约生命