如何在构建时避免Android Studio中的java.util.zip.ZipException

时间:2016-01-08 08:17:09

标签: java android

不建议清理构建或已经尝试过的./gredlew干净解决方案。

我只是想在不排除任何jar文件的情况下避免此错误。

错误详情

  

com.android.build.api.transform.TransformException:   java.util.zip.ZipException:重复条目:   机器人/支撑/ V7 / cardview / BuildConfig.class

这是我的Build.gradle依赖项

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile project(':material')
    compile project(':cardViewLib')
    compile ('com.android.support:appcompat-v7:21.0.3') {
        exclude module: 'com.android.support/v7/cardview/BuildConfig.class'
    }
} 

1 个答案:

答案 0 :(得分:0)

这里我是如何找到解决这个问题的解决方案的。首先,我删除了我用作模块的材料和cardview项目。然后我直接将其添加到我的build.gradle依赖项中作为依赖项

添加此

compile 'com.github.rey5137:material:1.2.2'
compile 'com.android.support:cardview-v7:23.1.1'

而不是使用此

compile project(':material')
compile project(':cardViewLib')