Ошибка повторяющегося класса в модулях при попытке использовать Javers в приложении Android - PullRequest
1 голос
/ 27 июня 2019

Когда я добавил зависимость для Javers в свой файл Gradle, добавив реализацию 'org.javers: javers-core: 5.6.0'

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

Я получил это сообщение об ошибке,Как я могу решить проблему?

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.

Вот также мой build.gradle для модуля приложения:

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'
}

1 Ответ

1 голос
/ 28 июня 2019

Вы должны докопаться до своих зависимостей и по-настоящему понять, что вы делаете, но быстрое исправление может выглядеть примерно так:

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

Вы хотите прочитать об исключении зависимостей, так как приведенная выше может быть неправильной. Прочитайте это:

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

Вы также можете увидеть, какие у вас зависимости, с помощью команды:

./gradlew app:dependencies

Это покажет вам все, если вы не поймете, отредактируйте ваш вопрос с помощью результата этой команды.

...