Jack tileman
Jack tileman

Reputation: 871

Duplicate class com.google.common.annotations.Beta found in modules jetified-guava-32.0.1-android and jetified-guava-jdk5-13.0

We are building a mobile application on android using java. The backend database is cloud firebase.

The application was "build"ing find until we introduced a new implementation dependency in the app - build.gradle. This implementation dependency is

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

Once we added this dependency we get the following errors -

Duplicate class com.google.common.util.concurrent.UncheckedTimeoutException found in modules jetified-guava-32.0.1-android (com.google.guava:guava:32.0.1-android) and jetified-guava-jdk5-13.0 (com.google.guava:guava-jdk5:13.0)
Duplicate class com.google.common.util.concurrent.Uninterruptibles found in modules jetified-guava-32.0.1-android (com.google.guava:guava:32.0.1-android) and jetified-guava-jdk5-13.0 (com.google.guava:guava-jdk5:13.0)
Duplicate class com.google.common.util.concurrent.package-info found in modules jetified-guava-32.0.1-android (com.google.guava:guava:32.0.1-android) and jetified-guava-jdk5-13.0 (com.google.guava:guava-jdk5:13.0)

It is clear that two dependencies are pointing to two different versions of Guava. How do I find which of these dependencies have these versions?

Based on various SO answers we implemented -

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

But this has not helped solve the issue. Here is the complete list of dependencies.

dependencies {

    def fragment_version = "1.5.5"

    implementation 'com.google.firebase:firebase-firestore:24.10.3'
    implementation platform('com.google.firebase:firebase-bom:29.3.0')

    // Declare the dependency for the Cloud Storage library
    // When using the BoM, you don't specify versions in Firebase library dependencies
    implementation 'com.google.firebase:firebase-storage'

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.google.android.material:material:1.6.0"

    implementation "androidx.fragment:fragment:$fragment_version"

    testImplementation 'junit:junit:4.12'

    implementation "androidx.multidex:multidex:2.0.0"


    implementation 'com.google.http-client:google-http-client-jackson2:1.20.0'
    implementation 'com.google.api-client:google-api-client-android:1.20.0'
    implementation 'com.google.code.gson:gson:2.4'
    implementation project('libraries:volley')
    implementation 'com.google.android.material:material:1.0.0-rc01'
    implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'


    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-appindexing:19.0.0'
    implementation 'com.google.firebase:firebase-auth:19.2.0'


    // implementation 'com.google.guava:guava:31.1-android'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' // https://stackoverflow.com/questions/60472354/duplicate-class-com-google-common-util-concurrent-listenablefuture-found-in-modu


    // implementation 'com.google.guava:guava:31.1-jre'          // https://stackoverflow.com/questions/56639529/duplicate-class-com-google-common-util-concurrent-listenablefuture-found-in-modu

}

If we remove the com.google.firebase:firebase-firestore:24.10.3 dependency the code builds fine. How do I find the dependencies that has the different versions of guava?

Upvotes: 0

Views: 178

Answers (0)

Related Questions