首页 > 解决方案 > firestore 和 google photos 依赖冲突

问题描述

将 Google 照片添加到 gradle 文件后,我遇到以下错误。Firestore 依赖项已添加。一旦我添加了谷歌照片,就会发生以下错误。请帮忙。

错误:在项目“应用程序”中,已解析的 Google Play 服务库依赖项依赖于另一个确切版本(例如“[1.10.1]”,但未解析为该版本。库表现出的行为未知。

Dependency failing : io.grpc : grpc - auth : 1.10.1->io.grpc : grpc - core@[1.10.1], but grpc - core version was 1.16.1.

The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
--Project 'app' depends onto io.grpc:grpc - core@1.16.1
--Project 'app' depends onto io.grpc:grpc - protobuf@1.10.1
--Project 'app' depends onto com.google.firebase:firebase - firestore@18.2.0
--Project 'app' depends onto io.grpc:grpc - auth@1.10.1
--Project 'app' depends onto io.grpc:grpc - protobuf - lite@1.16.1
--Project 'app' depends onto io.grpc:grpc - android@1.16.1
--Project 'app' depends onto io.grpc:grpc - okhttp@1.16.1
--Project 'app' depends onto com.google.api:gax - grpc@1.29.0
--Project 'app' depends onto com.google.photos.library:google - photos - library - client@1.1.0
--Project 'app' depends onto io.grpc:grpc - stub@1.16.1

For extended debugging info execute Gradle from the command line with . / gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact.This error message came from the google - services Gradle plugin, report issues at https ://

github.com / google / play - services - plugins 并通过将“googleServices { disableVersionCheck = false }”添加到您的 b uild.gradle 文件来禁用。

Build.gradle(模块:应用程序)

apply plugin : 'com.android.application'

android{
    compileSdkVersion 28
    defaultConfig{
    applicationId "com.savera.nammaflat"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes{
    release{
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies{
    implementation 'com.android.support:support-v4:28.0.0'
    /*https://stackoverflow.com/questions/55546885/google-api-client-android-and-firestore-is-giving-dexarchivemergerexception-buil*/
    configurations{
    all*.exclude module : 'guava-jdk5'
}
implementation fileTree(include: ['*.jar'], dir : 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation('com.android.support:design:28.0.0')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//Google sheets
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'pub.devrel:easypermissions:2.0.1'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
    exclude group : 'org.apache.httpcomponents'
        exclude group : 'com.google.common.annotations'
}

// Google photos
implementation 'com.google.photos.library:google-photos-library-client:1.1.0'


// Firebase Authentication
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation('com.google.firebase:firebase-firestore:18.2.0') {
    exclude group : 'com.google.common.annotations'
}
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'


}

apply plugin : 'com.google.gms.google-services'

构建.gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories{
        google()
        jcenter()

    }
        dependencies{
        classpath 'com.android.tools.build:gradle:3.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects{
    repositories{
    google()
    jcenter()

}
}

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

标签: androidgradle

解决方案


无法解决此依赖冲突问题。尝试了几种方法,但无法解决问题。而不是使用 // Google 照片实现 'com.google.photos.library:google-photos-library-client:1.1.0'

我使用了谷歌照片休息 api + volley。它工作正常。


推荐阅读