Android Studio 3.0.1在添加了
compile 'com.android.support:appcompat-v7:23.4.0'
之后,再次添加
compile 'com.jakewharton:butterknife:8.8.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
编译时,会报:
Error:Execution failed for task ':addresslist:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
错误,原因分析为:Butterknife8.8.1版本默认添加com.android.support:support-compat:25.3.0依赖,但是我的工程已经添加了com.android.support:support-compat:23.4.0,
导致一个项目中添加了同一个library的不同version
解决方法为:将butterknife换成较低的版本:
compile 'com.jakewharton:butterknife:8.0.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.0.1'