如何修复 ClassNotFoundException? [英] How to fix ClassNotFoundException?

查看:18
本文介绍了如何修复 ClassNotFoundException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很奇怪...我已将 sdk 版本更新为 25,然后尝试午餐应用程序.. 并得到这样的错误

This is something strange... I have updeted sdk version to 25 and after that tried to lunch app.. and got such error

FATAL EXCEPTION: main
Process: com.fittingroom.newtimezone, PID: 2465
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.fittingroom.newtimezone/com.fittingroom.newtimezone.view.ActivitySplash}: java.lang.ClassNotFoundException: Didn't find class "com.fittingroom.newtimezone.view.ActivitySplash" on path: DexPathList[[zip file "/data/app/com.fittingroom.newtimezone-2/base.apk"],nativeLibraryDirectories=[/data/app/com.fittingroom.newtimezone-2/lib/arm, /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:7224)
   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.fittingroom.newtimezone.view.ActivitySplash" on path: DexPathList[[zip file "/data/app/com.fittingroom.newtimezone-2/base.apk"],nativeLibraryDirectories=[/data/app/com.fittingroom.newtimezone-2/lib/arm, /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:7224) 
   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.fittingroom.newtimezone.view.ActivitySplash
   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

我已经将所有依赖项更新为 25,但无论如何我都会收到此错误.

I have already updated all dependency to 25 but anyway I get this error.

错误说我没有这个类,但我有

Error said that I don't have such class, but I have

我做错了什么?如何解决这个问题?

What am I doing wrong? How to fix this issue?

谢谢

推荐答案

好吧,我遇到了和我刚用过的一样的:

Well I faced the same I just used :

文件 -> 使缓存无效/重新启动

File -> Invalidate Caches / Restart

它对我有用.

这篇关于如何修复 ClassNotFoundException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆