最近引用Fresco,遇到了一堆引用报错导致编译不同过。下面是中文引导:
然后集成这些第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'
}
希望能帮助到你