Truth extensions causing rest of project to downgrade to guava android
14:23 09 Jan 2021

If I add the com.google.truth.extensions:truth-proto-extension:1.1 jar to my bazel workspace, it seems to totally nuke the classes from com.google.guava:guava:28.2-jre, resulting in errors like

import static com.google.common.collect.ImmutableMap.toImmutableMap;
^
  symbol:   static toImmutableMap
  location: class ImmutableMap
java/com/google/fhir/protogen/ProtoGenerator.java:316: error: cannot find symbol
            .collect(toImmutableMap(def -> def.getId().getValue(), def -> def));
                     ^
  symbol:   method toImmutableMap((def)->def[...]lue(),(def)->def)
  location: class ProtoGenerator

Your documentation says

One warning: Truth depends on the “Android” version of Guava, a subset of the “JRE” version.
If your project uses the JRE version, be aware that your build system might select the Android version instead.
If so, you may see “missing symbol” errors.
The easiest fix is usually to add a direct dependency on the newest JRE version of Guava.

Does this mean anything other than the maven dep on com.google.guava:guava:28.2-jre? If not, what's the next easiest fix?

google-truth