4

I'm getting this error while compiling my project. I've found out that's because of Guava, and reason why I'm getting this, is other lib is using Guava (this component of Guava) too (maybe other version, or just duplicated). I can't find out which one. I am using Guava to do hashing while saving my password while logging. I know it's necessary to exclude it, but i don't know exactly what and how.

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'}
SkypeDogg
  • 1,000
  • 2
  • 13
  • 28

3 Answers3

11

I found a workaround: just use 'com.google.guava:guava:26.0-android' instead of 'com.google.guava:guava:27.0-android'. Then the issue gone!

And, I also hope someone can tell the root cause.

xiaominglui
  • 349
  • 3
  • 8
  • Thank you very much, it's working now. There was duplicated class InternalFutureFailureAccess inside util.concurrent.internal, and looks like there is no such class in 26.0, another option was to remove guava from compiles, because i couldn't find the second one, maybe exclude would do the work too. – SkypeDogg Oct 22 '18 at 10:43
6

The latest release of Guava (27.0.1: https://github.com/google/guava/releases/tag/v27.0.1) has fixed this problem. Just use this:

implementation 'com.google.guava:guava:27.0.1-android'
Peter
  • 10,910
  • 3
  • 35
  • 68
4

This works for me:

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