0

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.

**Build.gradle**:-
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    lintOptions {
        // set to true to turn off analysis progress reporting by lint
        quiet true
        // if true, stop the gradle build if errors are found
        abortOnError false
        // if true, only report errors
        ignoreWarnings true
    }

    defaultConfig {
        applicationId "com.org.mobility"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 4
        versionName "1.6.1"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        repositories {
            maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
            mavenCentral()
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.android.support:support-v4:24.0.0'

    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'

}

Any help is appreciated. Thanks in advance.

Mstack
  • 321
  • 1
  • 12

4 Answers4

0

Please make sure that you have imported this in your app gradle file

android {
..
    useLibrary 'org.apache.http.legacy'
..
}
Krunal Kapadiya
  • 2,853
  • 3
  • 16
  • 37
0

Here is solution, you have to edit code as below

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

 packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
  }
}

Add above code inside android tag. Hope this will help you.

Sanwal Singh
  • 1,765
  • 3
  • 17
  • 35
0

Add this in your gradle to exclude the conflicts

compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1' {
exclude module: 'httpclient' 
exclude group: 'org.apache.httpcomponents' 
exclude group: 'org.apache.httpcomponents', module: 'httpclient'

}

Sharath
  • 691
  • 8
  • 23
  • its showing new warning like Warning:library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser. – Mstack Nov 30 '16 at 09:27
  • Could not find method com.google.code.ksoap2-android:ksoap2-android:3.6.1() for arguments [build_bp7i02jonpi9yt3yo241ty8qf$_run_closure2$_closure10@3f7a69a3] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler – Mstack Nov 30 '16 at 09:35
  • This page might help. http://stackoverflow.com/questions/18774355/adding-ksoap-dependency-to-gradle-project – Sharath Nov 30 '16 at 09:48
  • But want to minifyEnabled should be true. – Mstack Nov 30 '16 at 09:52
0

Try to exclude httpclient in your build.gradle. Paste the code below in your build,gradle and rebuild. The warning should go away.

configurations {
    compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}

Here is how the build looks after excluding the httpclient module enter image description here

Ajay B
  • 746
  • 9
  • 19