Google Play服务GCM 10.0.1要求"更新"回9.0.0

Jul*_*aKo 6 android gradle google-play-services build.gradle

我正在尝试构建我的新项目,但是我收到了这个错误:

错误:任务':mobile:processDebugGoogleServices'的执行失败.请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息,访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或将com.google.android.gms的版本更新为9.0.0.

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

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.julia.android.example_project"
        minSdkVersion 10
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildTypes.each {
        it.buildConfigField 'String', 'API_KEY', myKey
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.0.1'
    ...
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    wearApp project(':wear')
}
Run Code Online (Sandbox Code Playgroud)

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

我试图移动apply plugin: 'com.google.gms.google-services'到我的app/build.gradle文件的底部,但它没有成功.

请问有什么想法吗?

DR *_*aus 25

今天早些时候有这个问题.在应用Android应用程序插件之前,只需应用google服务插件即可.

更新以下行:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

至:

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
Run Code Online (Sandbox Code Playgroud)

  • 它有效,但不知道为什么我在谷歌文档上找不到任何解释.真的很糟糕.....顺便说一下,非常感谢. (2认同)

Fra*_*ran 5

我有同样的问题,我解决了它在项目中寻找所有"build.grade"文件,将所有版本从9.8.0更改为10.0.1(你可以搜索"在路径中查找"来搜索9.8 .0字符串),我有一个丢失,这导致错误.

而且行:

compile 'com.google.android.gms:play-services-appindexing:9.8.0'
Run Code Online (Sandbox Code Playgroud)

必须替换为:

compile 'com.google.firebase:firebase-appindexing:10.0.1'
Run Code Online (Sandbox Code Playgroud)

  • 不,它没有解决问题. (2认同)