I am using Android Espresso. I needed espresso-web to work with webviews. I set my espresso according to google website.
https://google.github.io/android-testing-support-library/downloads/index.html
My dependencies looks like that:
dependencies {
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.squareup.spoon:spoon-client:1.1.10'
androidTestCompile 'com.jraska:falcon-spoon-compat:0.3.1'
androidTestCompile 'com.android.support:support-annotations:23.1.1'
androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile 'com.android.support.test:rules:0.4.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2.1'
androidTestCompile "org.mockito:mockito-core:1.10.19"
androidTestCompile "com.google.dexmaker:dexmaker:1.2"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:1.2"
}
When I comment espresso-web imports/methods and exclude this lib then tests run. But with it I get:
Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.google.guava/guava/pom.properties
File1: /Users/F1sherKK/Dev/MyProject/app/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-web/2.2.1/jars/classes.jar
File2: /Users/F1sherKK/Dev/MyProject/app/build/intermediates/exploded-aar/com.android.support.test.espresso/espresso-core/2.2.1/jars/classes.jar
Seems to be some problem with guava. Espress-web lib generates both folders: espresso-web, espresso-core. Espresso-core lib also generates espresso-core and they seem to overlap - but that's how setup says it should be. Excluding Espresso-core lib doesn't help there. Any idea how to fix it?
Edit:
Workaround for now in packagingOptions:
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
Adding
packagingOptions {
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
to build.gradle file worked for me.
Try the other way around. Do not use espresso-core but just espresso-web. Example:
Espresso Official Test Kit Blog Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With