【发布时间】:2012-03-27 09:38:29
【问题描述】:
我的情况很奇怪,我不知道发生了什么。
代码一直在运行,直到我将 Android SDK 升级到 r17。
代码可以编译,但在运行时,Eclipse throws ClassNotFoundException(),在 PathClassLoader.class 中的 findClass 方法下
找不到的类是"org.apache.http.entity.mime.content.ContentBody" and "org.apache.http.entity.mime.content.StringBody"
我已经导入最新的(4.1.3) http components jar file into project-> properties-> java build path-> add external jar,
还清理了我的项目 N 次,但似乎没有任何效果。
这是来自 logcat:
03-27 17:31:32.461: W/dalvikvm(14263): VFY: unable to find class referenced in signature (Lorg/apache/http/entity/mime/content/ContentBody;)
03-27 17:31:33.802: E/dalvikvm(14263): Could not find class 'org.apache.http.entity.mime.content.StringBody', referenced from method com.milotin.core.base.MTBaseNetworkUtilities.getContentBody
03-27 17:31:33.802: W/dalvikvm(14263): VFY: unable to resolve new-instance 710 (Lorg/apache/http/entity/mime/content/StringBody;) in Lcom/milotin/core/base/MTBaseNetworkUtilities;
(抱歉粘贴乱七八糟,实际上只有 3 行来自 logcat)
我的 TargetSDK 是 API10,MinSDK 是 API8。
是什么原因??
【问题讨论】:
-
长话短说,Android SDK 改变了它跟踪项目中依赖项的方式。请在 StackOverflow 中搜索 Android r17。其他线程之一可能会回答您的问题。
-
是的!那是罪魁祸首!!我以前把那些 .jar 文件放在我的项目之外,现在我把它们移到我的项目/lib 文件夹中,问题就解决了。这是我得到解决方案的地方:stackoverflow.com/questions/9838069/jar-file-issue-with-adt-r17
标签: android eclipse classnotfoundexception apache-httpcomponents