【问题标题】:Excluding jar file duplicate from build从构建中排除 jar 文件重复
【发布时间】:2016-01-27 10:46:31
【问题描述】:

首先,我得到了这个:

* 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。

我尝试在我的 app 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>
    }

有没有更好的解决方案来消除重复?
具体写什么?

【问题讨论】:

  • 只需添加 compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 并从 lib 中删除 jar
  • project(':imagesubsampling') 的正确组和模块值是什么?你能显示imagesubsampling的build.gradle吗?

标签: android gradle dependencies duplicates redundancy


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-05
    • 1970-01-01
    • 2014-12-21
    • 1970-01-01
    • 2014-07-23
    • 2014-10-05
    • 2018-09-22
    相关资源
    最近更新 更多