Android Studio - 重复的类...在模块中找到...

4

我已经找了好几个小时,但是我找不到任何能够符合我的情况的解释。

每次构建项目时,我都会遇到相同的错误:

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

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

但是我完全不知道哪些依赖项导致了这个问题。

dependencies {

implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def dynamicanimation_version = '1.0.0'
implementation "androidx.dynamicanimation:dynamicanimation:$dynamicanimation_version"
implementation 'com.plattysoft.leonids:LeonidsLib:1.3.2'
implementation 'com.ajts.androidmads.sqliteimpex:library:1.0.0'
implementation 'com.google.android.gms:play-services-ads:19.7.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0')
        {
            exclude group: 'org.apache.httpcomponents'
        }
}

当搜索所有类时,我可以看到它们两个:

enter image description here

但我仍然不知道问题来自哪里。

我对此相对较新,可能会错过一些信息。我可以提供任何您可能需要的其他代码或错误信息。

感谢任何输入!

1个回答

8
我已经自己找到了答案。原来这与某些Firebase实现有关。
谷歌创建了一个包以解决这个问题。为了解决这个冲突,只需将以下内容添加到您的应用级别的build.gradle文件中即可;
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接