android - Google Play 服务 GCM 10.0.1 要求将 “update” 返回到 9.0.0

标签 android gradle google-play-services build.gradle

我正在尝试构建我的新项目,但出现此错误:

Error:Execution failed for task ':mobile:processDebugGoogleServices'. 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 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')
}

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
}

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

有什么想法吗?

最佳答案

今天早些时候遇到了这个问题。在应用 android 应用程序插件之前,只需应用 google 服务插件。

更新以下行:

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

到:

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

关于android - Google Play 服务 GCM 10.0.1 要求将 “update” 返回到 9.0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41010208/

相关文章:

java - 我怎样才能从通知转到我的 Viewpager 中添加的最后一个 fragment ?

android - 用于具有多个子项目的项目列表的自定义适配器?

java - 当我将手机更新到 Android 12 时,安装没有成功。无法安装应用程序 : INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

gradle - 从Eclipse启动Web应用程序时出现问题以及如何在build.gradle中将Jetty升级到9.4.20

java - 将新的 Google 登录添加到 Android 应用程序后的 Proguard 混淆问题

android - Play Services Analytics 是否与 Gradle 3.3/AndroidX 兼容?

android - 打开/qemu.conf失败,错误: 2

android - 使用 ndk clang 3.4/3.5 编译 __thread 不走运

android - Android Studio中的Gradle同步失败32位

Android Instant App Play 商店错误