org.apache.http.entity.FileEntity is deprecated in Android 6 (Marshmallow)

后端 未结 3 2197
粉色の甜心
粉色の甜心 2020-11-22 13:46

I\'m upgrading an app to API 23 where org.apache.http is deprecated.

My current (deprecated) code looks like this:

HttpClient httpClient         


        
3条回答
  •  一个人的身影
    2020-11-22 14:04

    Apache HttpClient 4.3 port for Android was intended to remedy the situation by providing official releases compatible with Google Android.

    Given that as of Android API 23 Google's fork of HttpClient has been removed this project has been discontinued.

    Those users who want to continue using Apache HttpClient on Android are advised to consider

    Apache HttpClient 4.3 port for Android when targeting Android API 22 and older

    dependencies {
        compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
    }
    

    Apache HttpClient packages for Android maintained by Marek Sebera when targeting Android API 23 and newer

    dependencies {
        compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
    }
    

    taken from Apache Official Website : Apache HttpClient for Android

    NOTE: You do not have to use useLibrary 'org.apache.http.legacy' statement, which was introduced for projects that didn't migrate from Android provided HttpClient classes. For further explanation.

提交回复
热议问题