Android ClassNotFoundException for HttpComponents

我们两清 提交于 2020-01-05 07:03:51

问题


I am in a weird situation, which I have no idea what's going on.

The code was working, until I upgraded my Android SDK to r17.

The code is able to compile, but during runtime, Eclipse throws ClassNotFoundException(), under findClass method, in PathClassLoader.class

The class that not found are "org.apache.http.entity.mime.content.ContentBody" and "org.apache.http.entity.mime.content.StringBody"

I already imported in the latest (4.1.3) http components jar file into project-> properties-> java build path-> add external jar,

and also clear my project N-times, yet nothing seems work.

This is from the 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;

(sorry for the messy paste, is actually just 3 lines from logcat)

My TargetSDK is API10, and MinSDK is API8.

What is the reason??


回答1:


Yes!! r17 is the culprit!! I used to put those .jar files outside my project, now I moved them into my project/lib folder, and problem solved. Here is where I got my solution: Jar-file issue with ADT r17

Thanks!



来源:https://stackoverflow.com/questions/9886928/android-classnotfoundexception-for-httpcomponents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!