程序类型已经存在:com.google.common.util.concurrent.internal.InternalFutureFailureAccess

时间:2018-10-22 09:41:33

标签: android compiler-errors dependencies guava android-guava

在编译项目时出现此错误。我发现这是由于Guava造成的,也是我得到此消息的原因,另一个库也在使用Guava(Guava的此组件)(也许是其他版本,或者只是重复的)。我找不到哪一个。我使用Guava进行哈希运算,同时在登录时保存密码。 我知道有必要将其排除在外,但我不知道到底是什么以及如何。

Program type already present: com.google.common.util.concurrent.internal.InternalFutureFailureAccess


    dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation "com.android.support:support-compat:28.0.0"
implementation 'com.amirarcane.recent-images:recentimages:2.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.mindorks:paracamera:0.2.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
implementation 'com.wdullaer:materialdatetimepicker:3.6.4'
implementation 'com.daimajia.numberprogressbar:library:1.4@aar'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
api 'com.google.guava:guava:27.0-android'
testImplementation 'junit:junit:4.12'}

3 个答案:

答案 0 :(得分:10)

我找到了一种解决方法:仅使用“ com.google.guava:guava:26.0-android”而不是“ com.google.guava:guava:27.0-android”。然后问题就解决了!

而且,我也希望有人能说出根本原因。

答案 1 :(得分:5)

最新版本的Guava(27.0.1:https://github.com/google/guava/releases/tag/v27.0.1)已解决此问题。只需使用此:

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

答案 2 :(得分:4)

这对我有用:

implementation(group: 'com.google.guava', name: 'guava', version: '27.0-android') {
    exclude group: 'com.google.guava' , module: 'failureaccess'
}