Android X + Truth + Guava test compile issue Android X + Truth + Guava test compile issue android android

Android X + Truth + Guava test compile issue


To fix the conflict, merely adding a dependency on Guava 27 should be enough. Doing so should automatically (though the "Version 99 Does Not Exist" hack described in the post you linked) prevent a second copy of ListenableFuture from being pulled in. (Please let us know if not!)

Since you're working on an Android library, it sounds like you want guava-27.0.1-android rather than -jre.

I don't know anything about your side question, sorry. And sorry for the lack of a response for so long.


something alike this should prevent the duplicate:

implementation ("com.google.android.material:material:1.1.0-alpha03") {    exclude group: "com.google.guava", module: "listenablefuture"}

the part which updates the library seems correct:

androidTestImplementation "com.google.guava:guava:27.0.1-android"androidTestImplementation ("com.google.truth:truth:0.42") {    exclude group: "com.google.guava", module: "guava"}

can only assume without a build.gradle.


Another thing that should probably "work" is to make your app itself (not just the tests, but the whole app) depend on guava:27.0.1-android. If your build uses Proguard, it should all get removed (aside from ListenableFuture) during the build. If you're not, though, then Guava is a big dependency to be pulling in, especially just to work around a bad interaction between our listenablefuture trick and the subsequent Android Gradle plugin :(