Dependency org.apache.httpcomponents:httpclient:4.4.1 is ignored for release as it may be conflicting with the internal version provided by Android

Firstly remove the lines compile 'org.apache.httpcomponents:httpcore:4.4.1' compile 'org.apache.httpcomponents:httpmime:4.4.1'

then at their place add the lines in build.gradle given by:

compile ('org.apache.httpcomponents:httpmime:4.3'){
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'commons-io:commons-io:1.3.2'

You can try this if your compileSdkVersion is 19(IN MY CASE) more preferably. Hope this will resolve the issue...


Use repacked version of the apache http client suitable for android

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

https://hc.apache.org/httpcomponents-client-4.3.x/android-port.html


Solution 1

I know this is so late but i'm posting here because accepted answer was not working for me

previously i used

dependencies {
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
    compile 'org.apache.httpcomponents:httpcore:4.3.2'
    compile files('libs/httpclient-4.2.1.jar')
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}

then i got the warning like question after that i commented some lines like bellow

dependencies {
    compile 'org.apache.httpcomponents:httpclient:4.5'
    compile 'org.apache.httpcomponents:httpmime:4.3.3'
    //compile 'org.apache.httpcomponents:httpcore:4.3.2'
    //compile files('libs/httpclient-4.2.1.jar')
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
}

now everything working fine

Edit

Solution 2

I got the best process than previous

add httpcore-4.3-beta1.jar and httpmime-4.3.jar in lib's folder and finally add

useLibrary 'org.apache.http.legacy' in your graddle file (Inside of android) as like bellow

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    //For http
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.app.videorotation"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
        ......
}