Abhishek
Abhishek

Reputation: 1345

HttpClient dependency Warning Android Studio

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    defaultConfig {
        applicationId "com.example"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven { url "https://jitpack.io" }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:support-v13:23.1.0'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
    compile 'oauth.signpost:signpost-core:1.2.1.2'
    compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
    compile('org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2')
    compile ('oauth.signpost:signpost-commonshttp4:1.2.1.2') {
        exclude module: 'commons-logging'
        exclude module: 'httpcore'
        exclude module: 'httpclient'
    }
    compile ('oauth.signpost:signpost-core:1.2.1.2') {
        exclude module: 'commons-codec'
        }
}

I am receiving below warnings

Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
         In case of problem, please repackage it with jarjar to change the class packages

No idea how to deal with it, any help would appreciate

Upvotes: 1

Views: 1168

Answers (2)

MH.
MH.

Reputation: 45503

A few things:

compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
compile('org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2')
compile ('oauth.signpost:signpost-commonshttp4:1.2.1.2') {
    exclude module: 'commons-logging'
    exclude module: 'httpcore'
    exclude module: 'httpclient'
}

You've added oauth.signpost:signpost-commonshttp4:1.2.1.2 twice: once without any excludes and once with. Try removing the one without to see if your warnings go away (they should).

Also, with the latest build tools version (you may have to upgrade to 23.0.2) you can remove this line:

compile('org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2')

(side note: that probably should've been a provided, not compile).

And then add to the android section, as illustrated here:

useLibrary 'org.apache.http.legacy'

Upvotes: 1

Luca Ziegler
Luca Ziegler

Reputation: 4164

Delete this line, it is double

compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'

Upvotes: 1

Related Questions