Saurabh Saurabh - 1 month ago 9
Android Question

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

I am using httpmime and httpcore in my project and I am getting this warning


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

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


my dependencies look like this

dependencies {
compile files('libs/gson-2.2.2.jar')
compile files('libs/classes.jar')
compile files('libs/gcm.jar')
compile files('libs/splunk-mint-4.2.jar')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpmime:4.4.1'}


As suggested in other places I added this to my build.gradle file

packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'}


Any idea how to solve this issue?

Answer

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

Comments