Gradle打包冲突,exclude依赖
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gradle打包冲突,exclude依赖相关的知识,希望对你有一定的参考价值。
参考技术A 然后集成这些第3方库会引起:FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':moffice:transformClassesWithJarMergingForDebug'.> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/DrawableRes.class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
其中annotation这个包多处引用:
解法:
利用终端:
gradlew :appname:dependencies 会罗列出你所有的改project依赖
这些都是引用树,你需要找到冲突的包然后干掉他
_debugCompile - ##Internal use, do not manually configure##
\--- com.android.support:appcompat-v7:23.4.0
+--- com.android.support:animated-vector-drawable:23.4.0
| \--- com.android.support:support-vector-drawable:23.4.0
| \--- com.android.support:support-v4:23.4.0
| \--- com.android.support:support-annotations:23.4.0
+--- com.android.support:support-v4:23.4.0 (*)
\--- com.android.support:support-vector-drawable:23.4.0 (*)
怎么改掉呢?
看这个: Gradle脚本分析 http://www.open-open.com/lib/view/open1431391503529.html
大致这样:
compile ('com.android.support:recyclerview-v7:23.4.0')
exclude group:'com.android.support'
希望能帮助到你
以上是关于Gradle打包冲突,exclude依赖的主要内容,如果未能解决你的问题,请参考以下文章