码迷,mamicode.com
首页 > 移动开发 > 详细

[Android Pro] Android API 23中废弃了HttpClient的解决办法

时间:2016-05-08 16:37:07      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

reference to : http://blog.csdn.net/hbwindy/article/details/51326019

reference to : http://blog.csdn.net/yangqingqo/article/details/48214865

 

今天在写网络连接的时候发现API 23中居然找不到HttpClient,官方文档似乎是这样说的。

This interface was deprecated in API level 22.
Please use openConnection() instead. Please visit this webpage for further details.

 那么只有再找办法,还真找到了:

To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:

do not need to copy sdk/platforms/android-23/optional/org.apache.http.legacy.jar into libs folder, system auto recoginise itself.

android {
        useLibrary ‘org.apache.http.legacy‘  
}

 proguard cofig :

 #不混淆org.apache.http.legacy.jar 
 -dontwarn android.net.compatibility.**
 -dontwarn android.net.http.**
 -dontwarn com.android.internal.http.multipart.**
 -dontwarn org.apache.commons.**
 -dontwarn org.apache.http.**
 -keep class android.net.compatibility.**{*;}
 -keep class android.net.http.**{*;}
 -keep class com.android.internal.http.multipart.**{*;}
 -keep class org.apache.commons.**{*;}
 -keep class org.apache.http.**{*;}

 

[Android Pro] Android API 23中废弃了HttpClient的解决办法

标签:

原文地址:http://www.cnblogs.com/0616--ataozhijia/p/5470765.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!