首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在android中删除java文件后的NoClassFoundError

在android中删除java文件后的NoClassFoundError
EN

Stack Overflow用户
提问于 2015-08-11 15:45:58
回答 3查看 477关注 0票数 1

我删除了一个名为ProductList_Activity.java文件的活动。现在,当我运行这个应用程序时,它崩溃了,错误如下。如何修复它?

错误日志:

代码语言:javascript
复制
E/AndroidRuntime(23686): FATAL EXCEPTION: main
E/AndroidRuntime(23686): Process: com.esouqatar.customer, PID: 23686
E/AndroidRuntime(23686): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.esouqatar.customer/com.esouqatar.customer.ProductList_Activity}: java.lang.ClassNotFoundException: Didn't find class "com.esouqatar.customer.ProductList_Activity" on path: DexPathList[[zip file "/data/app/com.esouqatar.customer-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime(23686):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2256)
E/AndroidRuntime(23686):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2405)
E/AndroidRuntime(23686):    at android.app.ActivityThread.access$800(ActivityThread.java:149)
E/AndroidRuntime(23686):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
E/AndroidRuntime(23686):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(23686):    at android.os.Looper.loop(Looper.java:211)
E/AndroidRuntime(23686):    at android.app.ActivityThread.main(ActivityThread.java:5315)
E/AndroidRuntime(23686):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23686):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(23686):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)             
E/AndroidRuntime(23686):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:736)   
E/AndroidRuntime(23686): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.esouqatar.customer.ProductList_Activity" on path: DexPathList[[zip file "/data/app/com.esouqatar.customer-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime(23686):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(23686):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime(23686):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime(23686):    at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
E/AndroidRuntime(23686):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2246)
E/AndroidRuntime(23686):    ... 10 more
E/AndroidRuntime(23686):    Suppressed: java.lang.ClassNotFoundException: com.esouqatar.customer.ProductList_Activity
E/AndroidRuntime(23686):        at java.lang.Class.classForName(Native Method)
E/AndroidRuntime(23686):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime(23686):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime(23686):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime(23686):        ... 13 more
E/AndroidRuntime(23686):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
EN

回答 3

Stack Overflow用户

发布于 2015-08-11 21:34:19

NoClassDefFoundError:在runtime期间类的定义不可用时抛出。此错误还表示在编译应用程序的过程中找到了类的定义,但在应用程序的classpath during runtime.More信息中无法访问SO Answer

如何解决

一般而言,Clean & Rebuild Project Then Restart。否则,

验证应用程序的类路径中是否包含所有必需的Java类。最常见的错误是在开始执行依赖于某些外部库的Java应用程序之前,没有包含所有必要的类。Courtesy

票数 2
EN

Stack Overflow用户

发布于 2015-08-11 15:51:52

在代码中的某些地方,类仍在使用中。要么查找并删除类实例,要么在需要文件时恢复该文件。

票数 0
EN

Stack Overflow用户

发布于 2018-04-28 08:08:33

右键单击项目,然后单击Run As -> Java Application

这为我解决了这个问题。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31936011

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档