项目问题:重复引入第三方jar包,导致Duplicate files copied in APK META-INF
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/rxjava.properties
File1: /Users/chenshouyin/.gradle/caches/modules-2/files-2.1/io.reactivex.rxjava2/rxjava/2.0.1/57f850a6b317e5582f1dbaff10a9e7d7e1fcdcfb/rxjava-2.0.1.jar
File2: /Users/chenshouyin/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.2.1/4e4cfa4adc74521d5966799fa5ab70b733552f68/rxjava-1.2.1.jar
很明显,这里是引入了二次rxjava,但是笔者配置文件里面引用了一个啊?!
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
分享原因是引入了第三方库,第三方库里面又引入了
rxjava-1.2.1.jar
解决办法是添加
packagingOptions {
exclude 'META-INF/替换为有冲突的依赖'
}
如