Category Archives: android-studio-2.1

how to remove duplicate entry from gradle file?

My app upload image, video, and audio to server then get the error.

Gradle build give error :-

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/message/BasicHeaderElementIterator.class

Here my gradle file code :-

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

dexOptions {
    incremental true
    javaMaxHeapSize "2048M"
}

useLibrary 'org.apache.http.legacy'
defaultConfig {
    applicationId "com.emaple"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

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'
}
}
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':simplecropimagelib')
compile files('libs/org.apache.http.legacy.jar')
compile files('libs/commons-io-2.4.jar')
compile 'com.android.support:support-v4'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.pnikosis:materialish-progress:1.5'
compile 'com.mcxiaoke.volley:library:1.0.17'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.jsoup:jsoup:1.8.1'
compile 'com.parse:parse-android:1.13.0'
compile 'com.parse.bolts:bolts-tasks:1.4.0'
compile 'com.commit451:PhotoView:1.2.4'
compile 'com.android.support:multidex:1.0.0'
compile 'com.splitwise:tokenautocomplete:1.3.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'    
compile 'org.apache.httpcomponents:httpmime:4.5.2'
compile 'org.apache.httpcomponents:httpcore:4.4.4'

How can solve this error any know then help me.

I have search on google try all solution but not get the result.

All solution give same error at build time.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/message/BasicHeaderElementIterator.class