Jack Wilson
Jack Wilson

Reputation: 6255

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

I got errors

Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-26.0-android.jar (com.google.guava:guava:26.0-android) and jetified-listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0)

Go to the documentation to learn how to Fix dependency resolution errors.

After update

classpath 'com.android.tools.build:gradle:3.5.3'

to

classpath 'com.android.tools.build:gradle:3.6.1'

and gradle 5.4.1 to 5.6.4

Problem solved when downgrade

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

to

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

Is this a bug of firebase/firestore?

Upvotes: 24

Views: 13629

Answers (8)

For the one who does not find a solution, this helped me. Add this dependency in your app/build.gradle file.

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

Source: https://github.com/firebase/firebase-android-sdk/issues/1320#issuecomment-601159166

Upvotes: 3

Apoorv Pandey
Apoorv Pandey

Reputation: 2531

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

add this to your gradle and you're good to go

Upvotes: 2

Feroz Khan
Feroz Khan

Reputation: 2856

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'

Upvotes: 27

joe06
joe06

Reputation: 458

I just added

implementation group: 'com.google.guava', name: 'guava', version: '27.0.1-android'

into my dependencies.

Upvotes: 0

Prakash S
Prakash S

Reputation: 652

If you have not added firestore as a dependency and still getting this error add below dependency to gradle

implementation group: 'com.google.guava', name: 'guava', version: '27.0.1-android'

Upvotes: 1

Ray Li
Ray Li

Reputation: 7919

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'

Upvotes: 26

wildcat12
wildcat12

Reputation: 1020

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.

Upvotes: 20

Peter Haddad
Peter Haddad

Reputation: 80952

The latest version of firestore is:

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

Upvotes: 1

Related Questions