Android 6.0 using Apache HttpClient

Source: Internet
Author: User

Android version 6.0 has basically removed the Apahce Http Client from the SDK.

So the question is, what if I used the Apache HttpClient related class in my previous project?

Please crossing the answer to the net

Apache HTTP Client Removal

Android 6.0 release removes support for the Apache HTTP client. The If your app is using the-client and targets Android 2.3 (API Level 9) or higher with the HttpURLConnection class instead. This API was more efficient because it reduces network use through transparent compression and response caching, and Minimi Zes power consumption. To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:

{' org.apache.http.legacy '} 

That is, add the above configuration to the Build.gradle.

Https://developer.android.com/intl/zh-cn/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

Another hole: Even if we are using Android 6, and have joined the following uselibrary configuration, there may be a compile error as follows:

"Unable to find optional library:org.apache.http.legacy"

Workaround:

1. See if there are Org.apache.http.legacy.jar and Optional.json under the catalogue E:\software\Android\sdk\platforms\android-23\optional.

2, if there is no Optional.json, then you create a new such file, and then add the following content:

[    {      "name": "Org.apache.http.legacy",      "jar": "Org.apache.http.legacy.jar",      "manifest": false    }  ]  

Reprint http://blog.csdn.net/liuhongwei123888/article/details/50100697

Android 6.0 using Apache HttpClient

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.