任务 ':app:transformClassesWithMultidexlistForDebug' 的执行失败重复的 Zip 条目
Execution failed for task ':app:transformClassesWithMultidexlistForDebug' Duplicate Zip Entry
我突然收到以下错误。该应用 运行 直到早上都还不错。从那时起我就得到了这个。我尝试从 Git 加载较旧的提交,但我现在遇到了同样的问题。我可以看到有一些 class 的重复条目,但不是很清楚在哪里。我已经检查了我所有的库以找出问题所在,但没有成功。请帮忙
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.aar1c80d72f0634c3cfc30b7ab8014102\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry[classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))`
我使用了很多库,因为我的应用程序非常 UI 为中心。
这是 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'
只需更改依赖项的版本-
来自
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
到
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
同步 >> 清理 >> 重建,然后完成
就我而言,此更改解决了我的问题。
此错误出现在 Android 发布 Support Library v27.1.0 之后(2018 年 2 月)。
我想,这个错误是因为项目中使用了一些依赖项。
compile 'com.another.library:1.2.3'
compile '.....'
因为每个依赖项都是另一个项目,具有它自己的依赖项。 Android 尝试在构建时将所有这些添加到项目中。如果依赖项使用另一个版本的支持库,则可能会发生这种冲突或重复。
可能您的某个依赖项在其 gradle 文件中有一行声明:
compile 'com.android.support:design:27.+'
这意味着 "use the newest release of 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'
}
更改依赖版本
使用这个
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
而不是
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
我突然收到以下错误。该应用 运行 直到早上都还不错。从那时起我就得到了这个。我尝试从 Git 加载较旧的提交,但我现在遇到了同样的问题。我可以看到有一些 class 的重复条目,但不是很清楚在哪里。我已经检查了我所有的库以找出问题所在,但没有成功。请帮忙
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.aar1c80d72f0634c3cfc30b7ab8014102\jars\classes.jar(;;;;;;**.class)]
(Duplicate zip entry[classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))`
我使用了很多库,因为我的应用程序非常 UI 为中心。
这是 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'
只需更改依赖项的版本-
来自
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
到
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
同步 >> 清理 >> 重建,然后完成
就我而言,此更改解决了我的问题。
此错误出现在 Android 发布 Support Library v27.1.0 之后(2018 年 2 月)。
我想,这个错误是因为项目中使用了一些依赖项。
compile 'com.another.library:1.2.3'
compile '.....'
因为每个依赖项都是另一个项目,具有它自己的依赖项。 Android 尝试在构建时将所有这些添加到项目中。如果依赖项使用另一个版本的支持库,则可能会发生这种冲突或重复。
可能您的某个依赖项在其 gradle 文件中有一行声明:
compile 'com.android.support:design:27.+'
这意味着 "use the newest release of 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'
}
更改依赖版本
使用这个
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
而不是
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'