从构建中排除 jar 文件重复项



首先,我得到了这个:

* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/nostra13/universalimageloader/cache/disc/DiskCache.class

我在我的应用程序项目中使用 UniversalImageLoader jar,但我还有一个库模块,它也使用完全相同的 jar。

我试图将类似的东西添加到我的应用程序build.gradle文件中:

 compile (project(':imagesubsampling')){
        exclude group: 'com.nostra13.universalimageloader', module: 'com.nostra13.universalimageloader'
    }

 compile (project(':imagesubsampling')){
        exclude group: 'com.nostra13', module: 'universalimageloader'
    }

 compile (project(':imagesubsampling')){
        exclude group: 'com.nostra13.universalimageloader'
    }

什么都没用。
因此,我的问题是:

 compile (project(':imagesubsampling')){
       <What to write here to exclude jar file from this library>
    }

有没有更好的解决方案来摆脱重复?
到底要写什么?

当有多个通用时,我遇到了这个问题项目中的图像加载器引用(可能在 libs 文件夹中,或者在项目的依赖项中,sublibs 中)。

再次检查项目中的所有build.gradle文件(在android工作室中)。保留一个并删除所有其他将解决问题

最新更新