Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidHttpClient and HttpGet API deprecated in Android 6.0 Marshmallow (API 23)

Today I have updated android SDK API 23.

As soon as I have changed my project to target Android SDK API 23, I started to get an error regarding Apache's client and AndroidHttpClient API in eclipse. Apache library API can no longer be found in API 23, nonetheless to continues to be working fine with API 22 and below.

Can someone kindly suggest what the problem is behind these errors?

enter image description here

One more error in project

enter image description here

enter image description here

enter image description here

Thanks.

like image 610
Ajit Kumar Dubey Avatar asked Feb 19 '26 17:02

Ajit Kumar Dubey


2 Answers

To continue using the Apache HTTP APIs, you must first declare the following compile-time dependency in your build.gradle file:

android {
    useLibrary 'org.apache.http.legacy'
}

Official reference: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

like image 135
Peter Zhao Avatar answered Feb 21 '26 14:02

Peter Zhao


The entire Apache API was removed from SDK 23 since from SDK 22 it was already deprecated.

You can see it here: http://developer.android.com/sdk/api_diff/23/changes.html

You can use Retrofit or Volley to reimplement your network requests.

like image 23
mthandr Avatar answered Feb 21 '26 15:02

mthandr