Android开发-httpclient兼容性问题
2017-08-07 23:24
561 查看
据说android 6.0之后已经将Apache Http Client移出SDK,build时出现“Unable to find optional library: org.apache.http.legacy”,建议使用HttpURLConnetction代替,如果非要用httpclient,网上的方法是在build.gradle中加入:
但仍然有错,还有进一步介绍要看platforms\android-23\optional目录下有没有org.apache.http.legacy.jar 和 optional.json。如果没有optional.json,则自己新建一个这样的文件,然后加入如下内容:
仍然没有。最后通过修改build参数编译通过:
android { useLibrary 'org.apache.http.legacy' }
但仍然有错,还有进一步介绍要看platforms\android-23\optional目录下有没有org.apache.http.legacy.jar 和 optional.json。如果没有optional.json,则自己新建一个这样的文件,然后加入如下内容:
[ { "name": "org.apache.http.legacy", "jar": "org.apache.http.legacy.jar", "manifest": false } ]
仍然没有。最后通过修改build参数编译通过:
android { compileSdkVersion 25 buildToolsVersion '26.0.1' defaultConfig { applicationId "com.myname.cartools" minSdkVersion 19 targetSdkVersion 19 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { }
相关文章推荐
- android开发问题-关于Xutils框架出现无法访问HttpRequestBase 找不到org.apache.http.client.methods.HttpRequestBase解决方案
- Android网络开发之HttpClient
- 为 Android 开发访问 JAX-RS Web 服务的 Apache HttpClient 客户端 学习创建 Apache HttpClient Android 客户端
- Android开发:用getDrawingCache方法获取ImageView中的图像需要注意的问题 本篇文章来源于 Linux公社网站(www.linuxidc.com) 原文链接:http:/
- Android WebView 与HttpClient 共用本地cookie问题
- 【Android开发那点破事】解决Andriod使用HttpURLConnection 失败问题
- android google map 开发中的常见问题及解决(无法获取 google map apiKey 和Couldn't get connection factory client)
- Android 开发学习记录(4)---- httpclient使用(三)
- android httpclient 与 webView cookie同步问题
- Android开发 httpClient post方法请求tomcat服务器实现注册登陆
- Android使用Asynchronous Http Client完成登录保存cookie的问题
- Android httpclient接收xml乱码问题解决方法
- Android开发之httpclient文件上传实现
- Android 开发学习记录(2)---- httpclient使用(一)
- android google map 开发中的常见问题及解决(无法获取 google map apiKey 和Couldn't get connection factory client)
- android httpclient 服务器 ip 直连问题
- android的httpClient冲突问题
- Android网络开发中出现NoHttpResponseException 或者ClientProtocolException解决方法
- Android 开发学习记录(3)---- httpclient使用(二)
- Android 通过httpclient 调用碰到的问题总结