gpt4 book ai didi

android-studio - 错误:任务':app:transformClassesWithJarMergingForDebug CopyUtil.class的执行失败

转载 作者:行者123 更新时间:2023-12-03 04:00:48 36 4
gpt4 key购买 nike

我在android studio中制作了一个项目,但突然发生了错误

我今天没有在build.gradle中添加gradle,并且在我构建项目的早晨没有问题

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

这是我的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'
}

我对此一无所知

请您帮我解决这个问题?

最佳答案

我有完全相同的问题,我怀疑新的Android Studio / Gradle版本有问题,因为该问题是在将Android Studio从2.2.3升级到2.3之后出现的
我用gradlew app:dependencies检查了依赖关系树,但是commons-io似乎没有重复。 (见下文)
当我在android studio中使用Ctrl + N搜索CopyUtils类时,我实际上得到了2个类:
Ctrl+N search CopyUtils
编辑
我用find命令调查了缓存文件夹,并在不同的文件夹中得到了2个commons-io jar:

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



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


编辑2
commons-io似乎会包含自身,从而导致重复类(???)
从依赖关系树中可以看出:
+--- org.apache.commons:commons-io:1.3.2
| \--- commons-io:commons-io:1.3.2
我真的不知道为什么,这个问题以前没有出现过。
尽管如此,修改依赖关系仍然可以解决我的问题:
compile('org.apache.commons:commons-io:1.3.2'){
exclude module: 'commons-io'
}
依赖树:
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 (*)

关于android-studio - 错误:任务':app:transformClassesWithJarMergingForDebug CopyUtil.class的执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42943755/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com