Android 开发之 HttpClient Class can not find 之解决办法
2012-07-18 19:49
786 查看
Android 开发之 HttpClient Class can not find 之解决办法
相信大家在开发 Android 的过程中遇到过这么一种情况,那就是 “Could not find class ‘org.apache.commons.httpclient.HttpClient’”。
尤其是在 eclipse 的插件ADT升级之后,很容易出现该问题,昨天Google放出了ADT的升级包,然后我也就升级了一下开发环境,没想到前天还运行好好的程序,今天突然就不会工作了,检查log发现,HttpClient无法找到,但是在普通的Java运行环境下就可以正常运行。
因为Apache的HttpClient开发包,Google自己也定制了一份,已经内置到开发环境中了,所以我们如果使用纯粹的Apache原生态的HttpClient开发包就可能出现冲突的问题,每当Google升级ADT之后,说不定程序就Over了。
实在没有办法,那就把基于Apache原生态的HttpClient完全替换成Google定制后的类型吧,转换前后的代码对比如下:
请参照 http://blog.zhourunsheng.com/2012/03/android-5%BC%E%80%E5%8F%91%E4%B9%8B-httpclient-class-can-not-find-%E4%B9%8B%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95/
相信大家在开发 Android 的过程中遇到过这么一种情况,那就是 “Could not find class ‘org.apache.commons.httpclient.HttpClient’”。
尤其是在 eclipse 的插件ADT升级之后,很容易出现该问题,昨天Google放出了ADT的升级包,然后我也就升级了一下开发环境,没想到前天还运行好好的程序,今天突然就不会工作了,检查log发现,HttpClient无法找到,但是在普通的Java运行环境下就可以正常运行。
因为Apache的HttpClient开发包,Google自己也定制了一份,已经内置到开发环境中了,所以我们如果使用纯粹的Apache原生态的HttpClient开发包就可能出现冲突的问题,每当Google升级ADT之后,说不定程序就Over了。
实在没有办法,那就把基于Apache原生态的HttpClient完全替换成Google定制后的类型吧,转换前后的代码对比如下:
请参照 http://blog.zhourunsheng.com/2012/03/android-5%BC%E%80%E5%8F%91%E4%B9%8B-httpclient-class-can-not-find-%E4%B9%8B%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95/
相关文章推荐
- android.content.ActivityNotFoundException: Unable to find explicit activity class解决办法
- Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" 解决办法
- [置顶] Android开发之viewpager导报错误解决方法:错误代码 Caused by: java.lang.ClassNotFoundException: Didn't find class
- 关于android编程中遇到的Could not find class 'com.swetake.util.Qrcode错误的原因及解决办法
- 关于android编程中遇到的Could not find class 'com.swetake.util.Qrcode错误的原因及解决办法
- Android 解决因Android版本太低,导致Could not find class 错误的解决办法
- Tomcat报错:HTTP Status 500 (Wrapper cannot find servlet class)解决办法
- 【android】NDK开发编译C++文件出现Type 'jint' could not be resolved和Unresolved inclusion: <jni.h>的解决办法
- Android项目导入时 Could not find class的可能解决方法
- Could not find the main class.program will exit和java.lang.UnsupportedClassVersionError 错误的解决办法
- Android开发错误——Could not find class
- 举例说明Android开发中遇到的 java.lang.ClassCastException: java.lang.String这个问题的原因及其解决办法
- 运行android程序,Could not find *.apk的解决办法
- 解决Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.su
- Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core” 解决方法
- android "Could not find class 'org.apache.http.entity.mime.content.FileBody" error
- Android开发之~java.lang.ClassNotFoundException: Didn't find class "android.view.x" on path: ...
- Android代码混淆第三方jar,can't find referenced class的解决
- can't find class NavigationMenuView问题解决办法
- Warning:com.alipay.android.phone.mrpc.core.AndroidHttpClient: can't find referenced method 'org.apac