reference to : http://blog.csdn.net/hbwindy/article/details/51326019
reference to : http://blog.csdn.net/yangqingqo/article/details/48214865
今天在写网络连接的时候发现API 23中居然找不到HttpClient,官方文档似乎是这样说的。
1
2
|
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.
1
2
3
|
android {
useLibrary
'org.apache.http.legacy'
}
|
proguard cofig :
1
2
3
4
5
6
7
8
9
10
11
|
#不混淆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
本文转自demoblog博客园博客,原文链接http://www.cnblogs.com/0616--ataozhijia/p/5470765.html如需转载请自行联系原作者
demoblog