[Android Pro] The HttpClient solution was discarded in Android API 23

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.