The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required
来源:互联网 发布:c语言比较字符串长度 编辑:程序博客网 时间:2024/05/21 14:08
转载请注明来源: http://blog.csdn.net/u010194538/article/details/51218394
在android 6.0(API 23)中,Google已经移除了移除了Apache HttpClient相关的类、HttpResponse类。缺失jar包使用HttpResponse等会报错:
The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required
//获取服务器Json数据HttpUtils httpUtils = new HttpUtils();//发送URL请求httpUtils.send(HttpMethod.GET,Myconstants.NEWCENTERURL,new RequestCallBack<String>() {@Override//访问数据成功public void onSuccess(ResponseInfo<String> responseInfo) {String jsonData =<u><span style="color:#ff0000;"> responseInfo</span></u>.result;System.out.println(jsonData);}@Override//访问数据失败public void onFailure(HttpException error, String msg) {System.out.println("网络请求数据失败"+error);}});
推荐使用HttpUrlConnection,如果要继续使用需要Apache HttpClient,需要在eclipse下libs里添加org.apache.http.legacy.jar。添加方法如下:
1>、Eclipse中 在错误原因上点击ctrl+1,选择Configure build path,或者Project->Properties->Java Build Path->Libraries->Add Ecternal JARS->你的SDK目录的
\platforms\android-23\optional\org.apache.http.legacy.jar->ok
2>、android studio里在相应的module下的build.gradle中加入:
android {
useLibrary 'org.apache.http.legacy'}
2 0
- The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required
- The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required
- The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required
- The type org.apache.http.Header cannot be resolved. It is indirectly referenced from required .class
- The type org.xmlpull.v1.XmlPullParser cannot be resolved. It is indirectly referenced from required
- The type org.apache.tools.ant.Task cannot be resolved. It is indirectly referenced from required .cl
- The type org.apache.axiom.om.OMElement cannot be resolved. It is indirectly referenced from require
- The type org.apache.axiom.om.OMElement cannot be resolved. It is indirectly referenced from require
- The type org.eclipse.core.commands.common.EventManager cannot be resolved. It is indirectly referenced from required .class file
- eclipse:The type java.lang.Object cannot be resolved. It is indirectly referenced from required
- The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....
- Java The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class
- The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required
- The type XXX cannot be resolved. It is indirectly referenced from required .class files
- The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
- The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required解
- The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required
- The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
- java和数据库之间的日期和时间转换
- 处理百万级以上的数据提高查询速度的方法
- C++第三次作业-2
- STL之 map
- C++实验4-学生类
- The type org.apache.http.HttpResponse cannot be resolved. It is indirectly referenced from required
- javascript基础六 (DOM优化)
- 手势用法和详解集合
- 日常整理的一些网址
- 【c/c++】typedef和define
- 同一个工程在两台电脑里用eclipse生成的apk的签名不同
- 串口通信代码
- C++虚函数表
- dubbo协议参考