Android 从构建中排除重复的jar文件

Android 从构建中排除重复的jar文件,android,gradle,dependencies,duplicates,redundancy,Android,Gradle,Dependencies,Duplicates,Redundancy,首先,我得到了这个: * 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/

首先,我得到了这个:

* 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')){
       <What to write here to exclude jar file from this library>
    }
编译(项目(':imagesubsampling')){ } 是否有更好的解决方案来消除重复项?

具体写什么?

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


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

只需添加编译“com.nostra13.universalimageloader:universalimageloader:1.9.5”并从库中删除jar,还可以检查
项目(“:imagesubsampling”)的正确组和模块值
?你能展示imagesubsampling的build.gradle吗?
 compile (project(':imagesubsampling')){
        exclude group: 'com.nostra13.universalimageloader'
    }
 compile (project(':imagesubsampling')){
       <What to write here to exclude jar file from this library>
    }