项目依赖module时可能会有相同的依赖,就会报以下错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/rockerhieu/emojicon/BuildConfig.class
gradle 排除部分依赖:
以前都是以为只有 用坐标依赖时,才能使用 exclude 类似
compile ('com.ali.reactandroid:react_android:0.8.0-SNAPSHOT'){
transitive = true
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-v7'
}
如果是本地项目只能下面这样:
compile project (':ReactSDK')
其实对本地的project也是可以进行exclude,只是需要在project 外面再包一层
compile(project(':react-native-custom-module')) {
exclude group: 'com.facebook.react', module: 'react-native'
}
exclude module :'*****'//by artifact name
exclude group:'*****' //by group
exclude group:'*****',module:'*****'//by both name and group
网友评论