Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-26.0-android.jar

I am using latest version of firebase firestore i.e.

implementation 'com.google.firebase:firebase-firestore:21.4.3'

and adding this line worked for me:

implementation 'com.google.guava:guava:27.0.1-android'

I think part of the issue is that Android Studio (or maybe the Gradle Plugin, however that is handled) is recommending to update the version of the Firestore dependency to 21.4.1 (likely depends on the order of repositories in your build.gradle - not sure on that). And yes, it seems that 21.4.1 causes the issue.

Gradle upgrade recommendation for Firestore lib to 21.4.1

So yeah, just ignore that recommendation and leave it at 21.4.0. Also...

  1. Firebase Docs show 21.4.0 as the correct version.
  2. MVN Repository shows 21.4.1 as the latest release.
  3. Google Maven Repo also lists 21.4.1 as the latest release.

After updating Firebase, I encountered this issue as well.

Fix the conflict by adding the following package to your build.gradle

implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'