My project transitively depends on Google Guava lib. Suddenly (with new version of Guava?) the application crashes at startup with
java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()'.
In Guava 29.0, this method is missing in 29.0-android, but available with 29.0-jre. Unfortunately, Gradle's dependency resolution chooses 29.0-android.
In a first attempt I fixed it in build.gradle like this:
configurations.all {
resolutionStrategy.dependencySubstitution {
// Because of java.lang.NoSuchMethodError: 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()'
substitute module('com.google.guava:guava:29.0-android') with module('com.google.guava:guava:29.0-jre')
}
}
Is there a more generic way to resolve this issue? If next Guava version 30.0-android/-jre comes up, my solution has to get fixed again.