Reference to:http://blog.csdn.net/hbwindy/article/details/51326019
Reference to:http://blog.csdn.net/yangqingqo/article/details/48214865
Today, when I wrote the Internet connection, I found that API 23 could not find HttpClient, and the official documentation seemed to say so.
This interface is deprecated in API level 22.Please use OpenConnection () instead. Please visit the webpage for further details.
Then only find a way, and really found:
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:
-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] The HttpClient solution was discarded in Android API 23