Почему я получаю эту ошибку Google Guava при запуске моего проекта? - PullRequest
1 голос
/ 05 июля 2019

Всякий раз, когда я пытаюсь запустить свой проект, я получаю следующую ошибку:

org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:checkDebugDuplicateClasses'.
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:checkDebugDuplicateClasses'
Caused by: com.android.ide.common.workers.WorkerExecutorException: 1 exception was raised by workers:
java.lang.RuntimeException: Duplicate class com.google.common.annotations.Beta found in modules guava-26.0-android.jar (com.google.guava:guava:26.0-android) and guava-annotations-r03.jar (com.google.guava:guava-annotations:r03)

полная трассировка стека: https://pastebin.com/8UBsXxme

файлы Gradle:

на основе приложения:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.example.sanchez.worldgramproject"
        minSdkVersion 21
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "0"


    }



    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }



    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}



dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])
    api "com.google.android.material:material:1.0.0"

    implementation 'com.github.madrapps:pikolo:1.1.6'
    implementation 'com.google.firebase:firebase-firestore:20.1.0'
    implementation 'com.firebaseui:firebase-ui-firestore:4.3.1'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.jakewharton:butterknife:10.1.0'
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha07'
    implementation 'androidx.core:core:1.0.2'
    implementation 'com.firebaseui:firebase-ui-storage:2.3.0'
    implementation 'com.firebaseui:firebase-ui-database:4.3.1'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.6'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.exifinterface:exifinterface:1.0.0'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'uk.co.mgbramwell.geofire:geofire-android:0.0.2'
    implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.1.1'
    implementation 'com.yarolegovich:lovely-dialog:1.1.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation "com.google.android.gms:play-services-location:17.0.0"
    implementation 'com.github.yalantis:ucrop:2.2.3'
    implementation 'com.victor:lib:1.0.4'
    implementation 'androidx.emoji:emoji:1.0.0'
    implementation 'com.github.greenfrvr:hashtag-view:1.3.1'
    compile 'com.vanniktech:emoji-ios:0.6.0'



    testImplementation 'junit:junit:4.13-beta-3'


}

на основе проекта:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'
        classpath 'com.google.gms:google-services:4.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
        maven { url 'https://jitpack.io' }

    }
}



task clean(type: Delete) {
    delete rootProject.buildDir
}

Я попытался пересобрать / очистить проект и синхронизировать с файлами Gradle, но ничего не получилось.

Проблема, как представляется, является причиной com.google.guava: guava-annotations: r03, но я не знаю, как найти зависимости, которые используют эту аннотацию.Что я могу сделать?

1 Ответ

1 голос
/ 05 июля 2019

Это означает, что аннотация @Beta Google Guava появляется дважды в вашей сборке.

Просто избавьтесь от com.google.guava:guava-annotations:r03 артефакта. Это с 2010 года, не обновляется и больше не поддерживается. Все аннотации из этого пакета включены в последние версии Guava.

Шаги:

  1. Узнайте, какой пакет требует com.google.guava:guava-annotations:r03

    ./gradlew app:dependencies
    
  2. Удалить зависимость:

    compile('com.example.m:m:1.0') {
      exclude group: 'com.google.guava', module: 'guava-annotations'
    }
    
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...