出现Caused by: java.lang.ClassNotFoundException:XXXXX in loader dalvik.system.PathClassLoader[/data

出现Caused by: java.lang.ClassNotFoundException:XXXXX in loader dalvik.system.PathClassLoader[/data/app/XXXX.apk]的解决方案:

在编写Android项目的时候,有时候会出现ClassNotFoundException这个错误,让我们先来看看别人是怎么解决的吧。

StackOverflow上有人这样回复:The fix was to just close and restart Eclipse and clean the project and clean all the dependent library projects. Then it started working properly again. It’s some sort of build problem in Eclipse, when refreshing the project files. Update: In particular, if you’ve accidentally modified the “.classpath” file (to revert to an older version), Eclipse/Android SDK can get confused and not build the project properly. When you restart Eclipse and clean the project, Eclipse will re-modify the “.classpath” file, and build properly.
翻译过来大致意思是:重启Eclipse并且clean the project(Eclipse导航栏Project ->Clean),然后refresh一下在运行项目。一般这个问题是因为eclipse adt 插件升级导致的。

这种方法是针对你的程序是完全正确的,只是Eclipse发了下神经而已。以下是大家程序出错的可能情况。

1、自己创建了一个Activity时,忘记在AndroidManifest.xml 添加一个activity,或者说activity的包名或者名字写错了,这个犯错几率很高的

2、第二种状况是你自己导入别人的开源项目,需要使用到外部的jar包,当在工程中编译使用时,发布成APK并没有包含JAR文件,所以APK在执行的时候就找不到JAR文件,会报错。

转载自

http://blog.csdn.net/changemyself/article/details/7861525

解决方案:右键自己的项目,Properties -> Java Build Path -> Order & Export, 然后选中Android Private Libraries, 菜单 Project->Clean,然后运行程序即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值