xiezefan / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
1 stars 0 forks source link

Having Guava and espresso-web as androidTest dependencies does not compile #166

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The espresso-web:2.2 release contains some classes from Guava. This makes it 
impossible to have espresso-web:2.2 and Guava as dependency for Android tests.

*What steps will reproduce the problem?*
1. Create a new Android project in AndroidStudio
2. Add espresso-web and Guava (or any other library that transitively depends 
on Guava) as dependencies for testing (see attached build.gradle)
3. Build the connectedAndroidTest target

*What is the expected output?*

I expect that the build succeeds and starts the tests

*What do you see instead?*

The build fails with an exception:

{{{
:app:dexDebugAndroidTest
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define 
Lcom/google/thirdparty/publicsuffix/PublicSuffixPatterns;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebugAndroidTest'.
> com.android.ide.common.process.ProcessException: 
org.gradle.process.internal.ExecException: Process 'command 
'/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' 
finished with non-zero exit value 2
}}}

*What version of the product are you using? On what operating system?*

Espresso 2.2, Guava 18.0 with AndroidStudio 1.2.2 on MacOS 10.10.4

Original issue reported on code.google.com by tim.haus...@grandcentrix.net on 13 Jul 2015 at 9:56

Attachments:

Fishfield commented 8 years ago

I have exactly the same issue. After looking at the source of espresso web, I figured out that the jarjar-rules.txt misses some configuration. In espresso-core they included:

rule com.google.thirdparty.publicsuffix.** android.support.test.espresso.core.deps.publicsuffix.@1

which is not part of the jarjar-rules.txt file in espresso-web.

I don't exactly know what this jarjar files are doing, so this is just what I think could cause the error