我从稳定的频道更新到
Android Studio 2.1.我一做到这一点,我就得到了我的登录类ClassNotFoundException,它在清单中声明了很长时间.在更新之前,我的应用程序编译正常.
com.myapp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myapp,PID: 29605 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.Login}: java.lang.ClassNotFoundException: Didn't find class "com.myapp.Login" on path: DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,/system/lib]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3023) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294) at android.app.ActivityThread.access$1000(ActivityThread.java:210) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.myapp.Login" on path: DexPathList[[zip file "/data/app/com.myapp-1/base.apk"],/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:1094) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3013) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3294) at android.app.ActivityThread.access$1000(ActivityThread.java:210) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1704) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) Suppressed: java.lang.ClassNotFoundException: com.myapp.Login 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) ... 13 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
这是我的gradle.build
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 'Google Inc.:Google APIs:23' buildToolsVersion "22.0.1" defaultConfig { applicationId "com.myapp" minSdkVersion 14 targetSdkVersion 22 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.txt' } } } dependencies { // compile files('libs/smack-core-4.0.7.jar') compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.google.android.gms:play-services:7.8.0' compile 'com.google.maps.android:android-maps-utils:0.4+' }
到目前为止我已经尝试过
1)清理和重建项目
2)删除构建文件夹并重建项目/重启Android Studio
3)切换到金丝雀频道以及开发频道和更新
4)在“设置”中选中并取消选中离线模式
显然这是一个错误,但有解决方案吗?如何撤消最近的更新?任何帮助深表感谢.
解决方法
试试这个:
清除应用缓存
清除应用数据
卸载应用
再次运行/调试
希望它有效!