使用Contrib和Web Espresso导入会导致重复文件异常 [英] Using Contrib and Web Espresso imports causes duplicateFileException
问题描述
我正在使用Android Espresso.我需要使用Contrib和Web,所以这里的解决方案对我不起作用. 链接
I am using Android Espresso. I need to use Contrib and Web so the solution here will not work for me. Link
我收到此错误.
Error:Execution failed for task ':transformResourcesWithMergeJavaResForQaDebugAndroidTest'.
com.android.build.api.transform.TransformException:com.android.builder.packaging.DuplicateFileException:在APK META-INF/maven/com.google.guava/guava/pom.xml中复制的重复文件 File1:C:\ Users \ jwhit \ ASProjects \ v2.0 \ build \ intermediates \ exploded-aar \ com.android.support.test.espresso \ espresso-web \ 2.2.1 \ jars \ classes.jar File2:C:\ Users \ jwhit \ ASProjects \ v2.0 \ build \ intermediates \ exploded-aar \ com.android.support.test.espresso \ espresso-core \ 2.2.1 \ jars \ classes.jar
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.google.guava/guava/pom.xml File1: C:\Users\jwhit\ASProjects\v2.0\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-web\2.2.1\jars\classes.jar File2: C:\Users\jwhit\ASProjects\v2.0\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.1\jars\classes.jar
这些已添加到我的gradle中,如下所示.
These are added in my gradle as shown below.
dependencies {
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'com.android.support:support-annotations:23.2.0'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile ('com.android.support.test.espresso:espresso-web:2.2.1')
androidTestCompile ('com.android.support.test.espresso:espresso-contrib:2.2.1'){
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
}
推荐答案
我找到了解决方案.将此添加到gradle构建的android部分
I found the solution to this. Add this to the android section of your gradle build
android{
packagingOptions {
pickFirst('META-INF/maven/com.google.guava/guava/pom.xml')
pickFirst('META-INF/maven/com.google.guava/guava/pom.properties')
}
}
我希望有人觉得这有用.
I hope someone finds this useful.
这篇关于使用Contrib和Web Espresso导入会导致重复文件异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!