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


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.**{*;}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM