Google Services依赖项冲突

时间:2018-07-04 15:01:17

标签: android google-play-services

我想更新项目中的每个库。现在我的成绩是这样的:

compile "com.google.android.gms:play-services-base:15.0.1"
    compile "com.google.android.gms:play-services-ads:15.0.1"
    compile "com.google.android.gms:play-services-location:15.0.1"
    compile "com.google.android.gms:play-services-identity:15.0.1"
    compile "com.google.android.gms:play-services-analytics:15.0.1"
    compile "com.google.android.gms:play-services-gcm:15.0.1"
    compile "com.google.android.gms:play-services-maps:15.0.1"
    compile 'com.google.android.gms:play-services-auth:15.0.1'
    compile 'com.google.firebase:firebase-core:15.0.1'

我收到错误消息:

Failed to resolve: com.google.android.gms:play-services-analytics:15.0.1

选中后,您会看到最新版本的Analytics Service为16.0.1。所以我这样改变成绩:

compile "com.google.android.gms:play-services-base:15.0.1"
    compile "com.google.android.gms:play-services-ads:15.0.1"
    compile "com.google.android.gms:play-services-location:15.0.1"
    compile "com.google.android.gms:play-services-identity:15.0.1"
    **compile "com.google.android.gms:play-services-analytics:16.0.1"**
    compile "com.google.android.gms:play-services-gcm:15.0.1"
    compile "com.google.android.gms:play-services-maps:15.0.1"
    compile 'com.google.android.gms:play-services-auth:15.0.1'
    **compile 'com.google.firebase:firebase-core:16.0.1'**

我遇到错误:

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 15.0.1.

也许您知道我该如何解决?

1 个答案:

答案 0 :(得分:1)

您还需要更新google services库。转到主App's gradle文件,并确保它看起来像这样:

 buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

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

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
}

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