遇到这个错误几次了,一直解决不了,很头痛;
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/maven/com.google.auto/auto-common/pom.xml
File1: C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.google.dagger\dagger-compiler\2.0.2\1170f75c1ce293f80755bbc9fcd60e0765022bd0\dagger-compiler-2.0.2.jar
File2: C:\Users\admin\.gradle\caches\modules-2\files-2.1\com.google.auto\auto-common\0.6\cf7212b0f8bfef12657b942df8f4f2cf032d3f41\auto-common-0.6.jar
有好多方法 ;如下
packagingOptions {
exclude ‘META-INF/DEPENDENCIES.txt’
exclude ‘META-INF/LICENSE.txt’
exclude ‘META-INF/NOTICE.txt’
exclude ‘META-INF/NOTICE’
exclude ‘META-INF/LICENSE’
exclude ‘META-INF/DEPENDENCIES’
exclude ‘META-INF/notice.txt’
exclude ‘META-INF/license.txt’
exclude ‘META-INF/dependencies.txt’
exclude ‘META-INF/LGPL2.1’
}
都解决不了 ,最后我得出的结果 是
dagger2 和butterknife 互斥,解决办法也找了 最终没有解决;
贴出来我的build.gradle
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
//realm
compile 'io.realm:android-adapters:1.3.0'
//support v7
compile 'com.android.support:appcompat-v7:24+'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
//dagger
compile 'com.google.dagger:dagger:2.6'
apt 'com.google.dagger:dagger-compiler:2.6'
compile 'org.glassfish.main:javax.annotation:4.0-b33'
//recyclerview
compile 'com.android.support:cardview-v7:24+'
compile 'com.android.support:recyclerview-v7:24+'
//butterknife
// compile 'com.jakewharton:butterknife:8.2.1'
// compile 'com.jakewharton:butterknife-compiler:8.2.1'
}