Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-20.0.jar (com.google.guava:guava:20.0)

后端 未结 8 1622
[愿得一人]
[愿得一人] 2020-12-08 03:58

When I use implementation \'com.google.firebase:firebase-inappmessaging-display:17.2.0\' in my app/build.gradle, I get this error:



        
相关标签:
8条回答
  • 2020-12-08 04:25

    I encountered the same problem. I added the line below

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

    This works but I encountered another issue- Cannot fit requested classes in a single dex file (# methods: 89411 > 65536) To resolve this error make sure to enable multiDex as below

    defaultConfig {
        applicationId "com.techweezy.smartsync"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 5
        versionName "1.4"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true //added this line
    }
    

    Then finally add the below lines.

       implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
        implementation 'androidx.multidex:multidex:2.0.1'
    
    0 讨论(0)
  • 2020-12-08 04:26

    I found the solution at How to solve Program type already present: com.google.common.util.concurrent.ListenableFuture?. user2297550 said:

    I merely added implementation 'com.google.guava:guava:27.0.1-android' at the end of my app gradle file and the error went away.

    That was the solution for me. Now I have this and my app compiles correctly:

    implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
    implementation 'com.google.guava:guava:27.0.1-android'
    
    0 讨论(0)
提交回复
热议问题