Apache HttpClient Android (Gradle)

前端 未结 8 2140
不知归路
不知归路 2020-12-04 12:11

I have added this line to my build.gradle

compile group: \'org.apache.httpcomponents\' , name: \'httpclient-android\' , version: \'4.3.5\'

8条回答
  •  一个人的身影
    2020-12-04 12:31

    if you are using target sdk as 23 add below code in your build.gradle

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

    additional note here: dont try using the gradle versions of those files. they are broken (28.08.15). I tried over 5 hours to get it to work. it just doesnt. not working:

    compile 'org.apache.httpcomponents:httpcore:4.4.1'
    compile 'org.apache.httpcomponents:httpclient:4.5'
    

    another thing dont use:

    'org.apache.httpcomponents:httpclient-android:4.3.5.1'
    

    its referring 21 api level.

提交回复
热议问题