ZipException:重复条目

时间:2018-02-14 14:04:16

标签: android zipexception

我无法构建apk文件。这是我的错误:

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

    com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/nineoldandroids/animation/Animator$AnimatorListener.class

我在stackoverflow上遇到了几乎所有类似的问题并尝试了解决方案。任何人都可以告诉我需要做些什么来消除这个问题。

以下是我在项目中使用的依赖项

 compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.eyalbira.loadingdots:loading-dots:1.0.2'
compile 'com.wang.avi:library:2.1.3'
compile 'com.gordonwong:material-sheet-fab:1.2.1'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'co.ronash.android:pushe-base:1.3.4'
compile 'me.leolin:ShortcutBadger:1.1.19@aar'
compile 'com.alexzh:circleimageview:1.2.0'
testCompile 'junit:junit:4.12'

这些是我的文章:

enter image description here

2 个答案:

答案 0 :(得分:0)

这是因为您的依赖项具有重复的 nineoldandroids 库。

您需要将其从依赖项中排除。包含nineoldandroids的库之一是 circleimageview 。您可以使用以下内容排除库:

compile ('com.alexzh:circleimageview:1.2.0') {
   exclude group: 'com.nineoldandroids', module: 'library'
}

您需要找到包含nineoldandroid库的其他库。

懒惰的解决方案是在你的模块build.gradle中使用配置块(我真的不鼓励使用这些配置):

configurations {
    // to avoid double inclusion of support libraries
    all*.exclude group: 'com.nineoldandroids', module: 'library'
}

dependencies {
  ...
}

答案 1 :(得分:0)

我解决了它:

compile ('com.gordonwong:material-sheet-fab:1.2.1') {
           exclude group: 'com.nineoldandroids', module: 'library'}
相关问题