Sphere
Log in Join
☆ 8

duplicate class com.google.common after upgrading a dependency

Android Gradle Plugin 8.3.2, Gradle 8.4. After bumping one library to 1.12 the build dies with Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-31.1-android and jetified-listenablefuture-9999.0-empty-to-avoid-conflict-with-guava. I've tried exclude group but it keeps coming back. What's the right way to sort this out for good?

⚑ Report

3 replies

☆ 3
G ghost ·2026-10-15#1

run ./gradlew :app:dependencies --configuration releaseRuntimeClasspath and find who actually pulls guava. Usually two libs bring different versions. Then either add a resolutionStrategy.force for one guava version, or exclude the transitive from whichever lib you can live without it from.

⚑ Report
☆ 0
A async ·2026-10-19#2

force did it. turns out the new lib pulled guava 31 and something else had 28. forcing 31 built clean. the dependency tree command was the genuinely useful part, should've started there instead of guessing excludes.

⚑ Report
☆ 0
P plastic ·2026-10-25#3

worth checking you're not fighting jetifier too. If you're fully androidx now set android.enableJetifier=false in gradle.properties, cuts out a lot of the jetified-* noise and speeds up configuration.

⚑ Report
Log in to reply.