Apache HttpClient Android (Gradle)

前端 未结 8 2113
不知归路
不知归路 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:42

    The accepted answer does not seem quite right to me. There is no point dragging a different version of HttpMime when one can depend on the same version of it.

    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
    compile (group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5') {
        exclude module: 'org.apache.httpcomponents:httpclient'
    }
    
    0 讨论(0)
  • 2020-12-04 12:48

    I resolved problem by adding following to my build.gradle file

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

    However this only works if you are using gradle 1.3.0-beta2 or greater, so you will have to add this to buildscript dependencies if you are on a lower version:

    classpath 'com.android.tools.build:gradle:1.3.0-beta2'
    
    0 讨论(0)
提交回复
热议问题