Polaris Nation
Polaris Nation

Reputation: 1225

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug CopyUtil.class

I make a project in android studio but suddenly it occurs error

I don't put gradle in build.gradle in today and it have no problem in the morning when I builde the project

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

This is my build.gradle

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    testCompile 'junit:junit:4.12'
    compile 'com.mobsandgeeks:android-saripaar:2.0.3'
    compile 'com.koushikdutta.ion:ion:2.1.9'
    compile 'gun0912.ted:tedpermission:1.0.2'
    compile 'com.android.support:design:24.+'
    compile 'com.estimote:sdk:0.13.0'
    compile 'jp.wasabeef:glide-transformations:2.0.0'
    compile 'com.afollestad:easyvideoplayer:0.3.0'
    compile 'fm.jiecao:jiecaovideoplayer:4.8.3'
    compile 'com.github.jrvansuita:PickImage:v2.0.0'
    compile 'gun0912.ted:tedbottompicker:1.0.3'
    compile 'com.github.jrvansuita:PickImage:v2.0.0'
    compile 'com.amazonaws:aws-android-sdk-s3:2.+'
    compile 'com.mindorks:placeholderview:0.6.0'

    compile 'com.tsengvn:Typekit:1.0.0'
    compile 'com.github.esafirm:RxDownloader:1.0.1'
    compile 'com.mlsdev.rximagepicker:library:1.1.2'
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'com.kbeanie:image-chooser-library:1.5.2@aar'
    compile 'com.kbeanie:image-chooser-library:1.5.8'
    compile 'io.github.jeancsanchez.photoviewslider:photoviewslider:1.2.0'
    compile 'com.nononsenseapps:filepicker:3.1.0'
    compile 'com.gjiazhe:scrollparallaximageview:1.0'
    compile 'com.droidninja:filepicker:1.0.8'
    compile 'com.mindorks:placeholderview:0.6.1'
    compile 'com.thoughtbot:expandablerecyclerview:1.3'

    compile 'com.android.support:multidex:1.0.0'
}

I don't have any idea for that

Please would you help me this problem?

Upvotes: 1

Views: 1710

Answers (2)

Prince Dholakiya
Prince Dholakiya

Reputation: 3401

The deployment of org.apache.commons:commons-io:1.3.2 was a mistake that was ultimately fixed by relocating the POM of org.apache.commons:commons-io:1.3.2 to use commons-io:commons-io:1.3.2. The mistake was likely an attempt to migrate the Commons IO library to use the current naming convention for Maven groupIds.

configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute module('org.apache.commons:commons-io:1.3.2') with module('commons-io:commons-io:1.3.2')
    }
}

Upvotes: 0

ClemB
ClemB

Reputation: 87

I have exactly the same problem, I suspect a problem with the new Android Studio / Gradle version because the problem appeared after updating Android studio from 2.2.3 to 2.3

I checked the dependency tree with gradlew app:dependencies but commons-io doesn't seem duplicated. (See below)

When I search for the class CopyUtils with Ctrl+N in android studio I effectively get 2 classes : Ctrl+N search CopyUtils

Edit

I investigated a bit the cache folder with the find command and got 2 commons-io jars in different folders:

./.gradle/caches/modules-2/files-2.1/commons-io/commons-io/1.3.2/b6dde38349ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar

AND

./.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-io/1.3.2/b6dde38349ba9bb5e6ea6320531eae969985dae5/commons-io-1.3.2.jar

Edit 2

commons-io seems ton include itself resulting in Duplicated class (???) As seen in the dependency tree :

+--- org.apache.commons:commons-io:1.3.2
|    \--- commons-io:commons-io:1.3.2

I really don't know why, and the problem didn't show up before. Still, modifying the dependency fixed the problem for me:

compile('org.apache.commons:commons-io:1.3.2'){
    exclude module: 'commons-io'
}

Dependency tree :

compile - Classpath for compiling the main sources.
+--- io.realm:realm-android-library:2.2.1
|    +--- io.realm:realm-annotations:2.2.1
|    \--- com.getkeepsafe.relinker:relinker:1.2.2
+--- io.realm:realm-annotations:2.2.1
+--- commons-httpclient:commons-httpclient:3.1
|    +--- commons-logging:commons-logging:1.0.4
|    \--- commons-codec:commons-codec:1.2
+--- slide:slide-webdavlib:2.1
|    +--- commons-httpclient:commons-httpclient:2.0.2 -> 3.1 (*)
|    +--- jdom:jdom:1.0
|    \--- de.zeigermann.xml:xml-im-exporter:1.1
+--- org.htmlparser:htmlparser:1.6
+--- org.apache.commons:commons-io:1.3.2
|    \--- commons-io:commons-io:1.3.2
+--- net.rdrei.android.dirchooser:library:3.2
|    +--- com.google.auto.value:auto-value:1.1
|    +--- com.github.frankiesardo:auto-parcel:0.3.1
|    +--- com.android.support:appcompat-v7:22.2.1 -> 25.3.0
|    |    +--- com.android.support:support-annotations:25.3.0
|    |    +--- com.android.support:support-v4:25.3.0
|    |    |    +--- com.android.support:support-compat:25.3.0
|    |    |    |    \--- com.android.support:support-annotations:25.3.0
|    |    |    +--- com.android.support:support-media-compat:25.3.0
|    |    |    |    +--- com.android.support:support-annotations:25.3.0
|    |    |    |    \--- com.android.support:support-compat:25.3.0 (*)
|    |    |    +--- com.android.support:support-core-utils:25.3.0
|    |    |    |    +--- com.android.support:support-annotations:25.3.0
|    |    |    |    \--- com.android.support:support-compat:25.3.0 (*)
|    |    |    +--- com.android.support:support-core-ui:25.3.0
|    |    |    |    +--- com.android.support:support-annotations:25.3.0
|    |    |    |    \--- com.android.support:support-compat:25.3.0 (*)
|    |    |    \--- com.android.support:support-fragment:25.3.0
|    |    |         +--- com.android.support:support-compat:25.3.0 (*)
|    |    |         +--- com.android.support:support-media-compat:25.3.0 (*)
|    |    |         +--- com.android.support:support-core-ui:25.3.0 (*)
|    |    |         \--- com.android.support:support-core-utils:25.3.0 (*)
|    |    +--- com.android.support:support-vector-drawable:25.3.0
|    |    |    +--- com.android.support:support-annotations:25.3.0
|    |    |    \--- com.android.support:support-compat:25.3.0 (*)
|    |    \--- com.android.support:animated-vector-drawable:25.3.0
|    |         \--- com.android.support:support-vector-drawable:25.3.0 (*)
|    +--- com.gu:option:1.3
|    \--- com.android.support:support-annotations:22.2.1 -> 25.3.0
+--- com.googlecode.juniversalchardet:juniversalchardet:1.0.3
+--- project :uploadservice-dav
|    +--- commons-net:commons-net:3.5
|    +--- project :uploadservice
|    |    +--- com.android.support:appcompat-v7:24.2.1 -> 25.3.0 (*)
|    |    +--- com.android.support:support-v4:24.2.1 -> 25.3.0 (*)
|    |    +--- com.squareup.okhttp3:okhttp:3.4.1
|    |    |    \--- com.squareup.okio:okio:1.9.0
|    |    +--- com.squareup.okhttp3:okhttp-urlconnection:3.4.1
|    |    |    \--- com.squareup.okhttp3:okhttp:3.4.1 (*)
|    |    \--- com.squareup.okhttp3:logging-interceptor:3.4.1
|    |         \--- com.squareup.okhttp3:okhttp:3.4.1 (*)
|    +--- com.squareup.okhttp3:okhttp:3.4.1 (*)
|    +--- com.squareup.okhttp3:logging-interceptor:3.4.1 (*)
|    +--- org.apache.jackrabbit:jackrabbit-webdav:2.10.1
|    |    +--- org.slf4j:slf4j-api:1.6.6 -> 1.7.4
|    |    +--- commons-httpclient:commons-httpclient:3.1 (*)
|    |    \--- org.slf4j:jcl-over-slf4j:1.7.4
|    |         \--- org.slf4j:slf4j-api:1.7.4
|    \--- org.apache.commons:commons-lang3:3.5
+--- com.google.code.gson:gson:2.7
+--- com.android.support:multidex:1.0.1
+--- com.android.support:appcompat-v7:25.3.0 (*)
+--- com.android.support:cardview-v7:25.3.0
|    \--- com.android.support:support-annotations:25.3.0
+--- com.android.support:design:25.3.0
|    +--- com.android.support:support-v4:25.3.0 (*)
|    +--- com.android.support:appcompat-v7:25.3.0 (*)
|    +--- com.android.support:recyclerview-v7:25.3.0
|    |    +--- com.android.support:support-annotations:25.3.0
|    |    +--- com.android.support:support-compat:25.3.0 (*)
|    |    \--- com.android.support:support-core-ui:25.3.0 (*)
|    \--- com.android.support:transition:25.3.0
|         +--- com.android.support:support-annotations:25.3.0
|         \--- com.android.support:support-v4:25.3.0 (*)
+--- com.android.support:gridlayout-v7:25.3.0
|    +--- com.android.support:support-compat:25.3.0 (*)
|    \--- com.android.support:support-core-ui:25.3.0 (*)
+--- com.android.support:mediarouter-v7:25.3.0
|    +--- com.android.support:appcompat-v7:25.3.0 (*)
|    \--- com.android.support:palette-v7:25.3.0
|         +--- com.android.support:support-compat:25.3.0 (*)
|         \--- com.android.support:support-core-utils:25.3.0 (*)
+--- com.android.support:palette-v7:25.3.0 (*)
+--- com.android.support:recyclerview-v7:25.3.0 (*)
+--- com.android.support:support-annotations:25.3.0
+--- com.android.support:support-v13:25.3.0
|    +--- com.android.support:support-annotations:25.3.0
|    \--- com.android.support:support-v4:25.3.0 (*)
+--- com.android.support:support-v4:25.3.0 (*)
+--- com.scottyab:secure-preferences-lib:0.1.4
|    \--- com.scottyab:aes-crypto:0.0.4
+--- com.facebook.stetho:stetho:1.4.1
|    +--- commons-cli:commons-cli:1.2
|    \--- com.google.code.findbugs:jsr305:2.0.1
+--- com.uphyca:stetho_realm:2.0.0
+--- com.github.gabrielemariotti.cards:cardslib-core:2.1.0
|    +--- com.android.support:support-annotations:22.1.1 -> 25.3.0
|    +--- com.android.support:support-v4:22.1.1 -> 25.3.0 (*)
|    \--- com.android.support:cardview-v7:22.1.1 -> 25.3.0 (*)
+--- com.github.gabrielemariotti.cards:cardslib-recyclerview:2.1.0
|    +--- com.android.support:support-annotations:22.1.1 -> 25.3.0
|    +--- com.android.support:recyclerview-v7:22.1.1 -> 25.3.0 (*)
|    \--- com.github.gabrielemariotti.cards:cardslib-core:2.1.0 (*)
+--- com.afollestad.material-dialogs:core:0.9.0.1
|    +--- com.android.support:recyclerview-v7:24.1.1 -> 25.3.0 (*)
|    +--- com.android.support:support-v4:24.1.1 -> 25.3.0 (*)
|    +--- me.zhanghai.android.materialprogressbar:library:1.1.7
|    |    +--- com.android.support:appcompat-v7:24.0.0 -> 25.3.0 (*)
|    |    \--- com.android.support:support-annotations:24.0.0 -> 25.3.0
|    +--- com.android.support:appcompat-v7:24.1.1 -> 25.3.0 (*)
|    \--- com.android.support:support-annotations:24.1.1 -> 25.3.0
+--- com.afollestad.material-dialogs:commons:0.9.0.1
|    +--- com.afollestad.material-dialogs:core:0.9.0.1 (*)
|    \--- com.android.support:appcompat-v7:24.1.1 -> 25.3.0 (*)
+--- com.gu:option:1.3
+--- com.nononsenseapps:filepicker:3.1.0
|    +--- com.android.support:appcompat-v7:24.2.1 -> 25.3.0 (*)
|    +--- com.android.support:support-v4:24.2.1 -> 25.3.0 (*)
|    \--- com.android.support:recyclerview-v7:24.2.1 -> 25.3.0 (*)
+--- ch.acra:acra:4.9.1
|    +--- com.android.support:support-v4:24.1.1 -> 25.3.0 (*)
|    \--- com.android.support:support-annotations:24.1.1 -> 25.3.0
+--- com.github.bumptech.glide:glide:3.7.0
+--- com.github.bumptech.glide:okhttp3-integration:1.4.0
\--- com.squareup.okhttp3:okhttp:3.4.1 (*)

Upvotes: 1

Related Questions