2

When I added the dependency for Javers in my gradle file by adding implementation 'org.javers:javers-core:5.6.0'

https://javers.org/documentation/getting-started/

I got this error message. How can I fix the issue?

Duplicate class  com.google.common.util.concurrent.internal.InternalFutureFailureAccess found in modules failureaccess-1.0.jar (com.google.guava:failureaccess:1.0) and guava-27.0-jre.jar (com.google.guava:guava:27.0-jre)
Duplicate class com.google.common.util.concurrent.internal.InternalFutures found in modules failureaccess-1.0.jar (com.google.guava:failureaccess:1.0) and guava-27.0-jre.jar (com.google.guava:guava:27.0-jre)
Go to the documentation to learn how to Fix dependency resolution errors.

Here is also my build.gradle for the app module:

apply plugin: 'com.android.application'
apply plugin: 'maven'


android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.mycompany.myapp"
        minSdkVersion 17
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding.enabled = true
    packagingOptions {
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/spring.schemas'
        exclude 'META-INF/spring.tooling'
        exclude 'META-INF/spring.handlers'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    compileOnly 'org.projectlombok:lombok:1.18.8'
    annotationProcessor 'org.projectlombok:lombok:1.18.8'




    implementation 'org.javers:javers-core:5.6.0'



    implementation 'com.squareup.retrofit2:retrofit:2.6.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
    implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.android.support:appcompat-v7:29.0.0'
    implementation 'com.google.android.gms:play-services-vision:18.0.0'
    implementation project(':AndroidHive')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Kamyar Miremadi
  • 169
  • 2
  • 7
  • Did you try this: (/troubleshooting_dependency_resolution.html)[https://docs.gradle.org/current/userguide/troubleshooting_dependency_resolution.html ?] – Blundell Jun 27 '19 at 19:01
  • I tried different things. It seems there are dependency conflict between the libraries I referenced in my projects. for now as a workaround I switched to the version 5.0.3 and added compiler option to my app/build.gradle compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } – Kamyar Miremadi Jun 27 '19 at 21:12

1 Answers1

1

You should get to the bottom of your dependencies and really understand what you are pulling in, but a quick fix could be something like:

dependencies {
  compile ('org.javers:javers-core:5.6.0') {
    exclude group: "com.google.guava", name: "guava:27.0-jre"
  }
}

You want to read up on excluding dependencies, as the one above might not be the right one. Take a read of this:

https://www.linkedin.com/pulse/how-find-dependencies-particular-dependency-gradle-hesamedin-kamalan-1/

You can also see what dependencies you have with the command:

./gradlew app:dependencies

This will show you everything, if you don't figure it out edit your question with the result of that command.

Blundell
  • 75,855
  • 30
  • 208
  • 233