0

In my Android project after I add some libraries when I'm running it a exception arose. my build.gradle file is as below.

android {
    compileSdkVersion 'Google Inc.:Google APIs:21'
    buildToolsVersion '23.0.2'
    defaultConfig {
        applicationId "com.marpak.livefarmerpro"
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 69
        versionName '2.0.15'
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
    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'
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}


dependencies {
    compile project(':holoColorPickermaster')
    compile project(':qRCodeReaderViewlib')
    compile project(':volley')
    compile project(':library')
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.android.support:multidex:'
    compile 'org.apache.httpcomponents:httpcore:4.4.4'
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'

}

and when I running the app ir gives me following error.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/concurrent/BasicFuture.class

I know this is because some duplication of files. can someone help he to fix this issue. thanks and regards!

Samantha Withanage
  • 3,811
  • 10
  • 30
  • 59

2 Answers2

1

I got this issue when I had 2 classes with the same class name. Doing ./gradlew app:assembleDebug --stacktrace --debug --info said

java.util.zip.ZipException: duplicate entry: com/arka/commonlib/model/Charge.class

halfer
  • 19,824
  • 17
  • 99
  • 186
Arka Prava Basu
  • 2,366
  • 3
  • 18
  • 34
0

You can test putting this on root of directory in the Terminal

./gradlew clean

for more detail visit this : Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'

Community
  • 1
  • 1