任务“:app:transformClassesWithMultidexlistForDebug”的执行失败,重复的Zip条目。

4

我突然遇到了下面的错误。这个应用程序早上之前一直运行得很好。从那时起,我就一直遇到这个问题。我尝试从Git中加载旧的提交,但现在我还是遇到了同样的问题。我可以看到某个类有重复的条目,但不太清楚是在哪里。我已经检查了所有的库来定位问题,但都没有成功。请帮忙。

Error:Execution failed for task 
':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [C:\Users\Bluetie Backup 3 
i5\Downloads\Bluetie_Android_NewDesign-
Development\Bluetie_Android_NewDesign-Development\BlueTieAndroid-
master\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't 
read [C:\Users\Bluetie Backup 3 i5\.gradle\caches\transforms-1\files-
1.1\support-core-ui-27.1.0.aar\781c80d72f0634c3cfc30b7ab8014102\jars\classes.jar(;;;;;;**.class)] 
(Duplicate zip entry[classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))`

我的应用程序非常注重用户界面,因此我使用了许多库。

以下是build.gradle文件:

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'
})
compile project(':rtp')
compile project(':pageIndicator')
compile files('libs/linkedin-j-android.jar')
//compile files('libs/commons-codec-1.3.jar')
//compile files('libs/signpost-core-1.2.1.1.jar')
compile project(':imagepicker')
compile project(':swipflingview')

compile project(':linkedin-sdk')
compile 'com.android.support:multidex:1.0.2'
//noinspection GradleCompatible
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-crash:11.0.2'
/* compile 'com.google.firebase:firebase-auth:11.0.2'*/
compile 'com.google.android.gms:play-services-analytics:11.0.2'
compile 'com.google.firebase:firebase-messaging:11.0.2'
compile 'com.google.android.gms:play-services-location:11.0.2'
/*compile 'com.google.android.gms:play-services-ads:11.0.2'*/
compile 'com.google.android.gms:play-services-auth:11.0.2'
/*  compile 'com.google.android.gms:play-services-gcm:11.0.2'*/
compile 'com.google.android.gms:play-services-places:11.0.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okio:okio:1.0.1'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.android.support:design:26.1.0'
compile ('com.facebook.android:facebook-android-sdk:4.6.0'){
    exclude module: 'support-v4'
}
compile 'com.squareup.picasso:picasso:2.4.0'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.appyvet:materialrangebar:1.3'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.jsibbold:zoomage:1.1.0'
compile 'com.michaelmuenzer.android:ScrollableNumberPicker:0.2.2'
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
compile ('com.nineoldandroids:library:2.4.0'){
    exclude module: 'support-v4'
}
compile 'uk.co.samuelwall:material-tap-target-prompt:1.1.4'
compile 'com.mikhaellopez:circularimageview:3.0.2'
compile 'com.android.support:percent:26.1.0'
compile('com.github.ozodrukh:CircularReveal:1.1.1') {
    transitive = true;
}
testCompile 'junit:junit:4.12'
compile project(':paralaxed_viewpager')
compile project(':tooltiplibrary'){
    exclude module: 'support-v4'
}
compile project(':pinview_lib')
compile 'com.github.travijuu:numberpicker:1.0.7'
compile 'com.razorpay:checkout:1.4.1'

compile 'com.github.travijuu:numberpicker:1.0.7'
compile 'com.razorpay:checkout:1.4.1'
compile project(':country_code_picker_library')
compile 'com.github.satyan:sugar:1.5'
compile 'org.igniterealtime.smack:smack-android:4.1.6'
compile 'org.igniterealtime.smack:smack-tcp:4.1.6'
compile 'org.igniterealtime.smack:smack-im:4.1.6'
compile 'org.igniterealtime.smack:smack-extensions:4.1.6'
compile 'com.jackandphantom.android:circularprogressbar:1.2.0'
compile 'com.jaredrummler:material-spinner:1.2.4'
compile 'com.skyfishjy.ripplebackground:library:1.0.1'

compile 'com.wonderkiln:camerakit:0.13.1'
compile 'com.droidninja:filepicker:2.1.2'
compile project(':autocompleteview')
compile 'com.appsflyer:af-android-sdk:4.8.7@aar'
compile 'com.android.installreferrer:installreferrer:1.0'

似乎您在构建中包含了多个版本的CoordinatorLayout。提供您的构建文件将有所帮助。 - Submersed
如何找出重复的条目? - Atul O Holic
嗨,请在这里发布您的 build.gradle 文件。谢谢! - Daksh Gargas
我从昨天开始遇到了同样的问题。虽然过去三天我没有做任何更改,之前一切都正常。可能是新更新的问题。 - parish
尝试将所有的 com.google.android.gms:play-services-... 进行注释,并使用 compile 'com.google.android.gms:play-services:11.8.0',然后清理项目并重新构建,然后尝试运行... 这对我起作用了。 - parish
显示剩余2条评论
3个回答

8
只需要更改依赖包的版本 -

compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'

to

compile 'com.theartofdev.edmodo:android-image-cropper:2.5.1'

同步 >> 清理 >> 重建,完成

在我的情况下,这些更改解决了我的问题。


非常感谢。但是实际上发生了什么,而且还突然? - Mayank Raj

3

这个错误是在 Android发布了Support Library v27.1.0(2018年2月)之后出现的。

我认为,这个错误是因为项目中使用了一些依赖项(dependencies)

compile 'com.another.library:1.2.3'
compile '.....'

由于每个依赖项都是另一个项目,有着自己的依赖关系。在构建时,Android 试图将所有这些都添加到项目中。如果一个依赖使用了支持库的另一个版本,则可能会发生冲突或重复。

可能您的某个依赖项在其 gradle 文件中声明了一行:

 compile 'com.android.support:design:27.+'

这段文本需要翻译为:

这意味着“使用最新发布的v.27版本”。

当v.27.1.0发布后,你自己的compile 'com.android.support:...:26.1.0'行会导致冲突。

解决方法如下:

你可以更新自己的依赖到新版本

或者

-如果你能找到-你可以使用v.27.1.0排除支持库中的依赖项:

compile('com.another.library:1.2.3') {
    exclude group: 'com.android.support', module: 'support-v13'
}

0

更改依赖版本

使用此版本

implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'

替代

implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接