【问题标题】:Version conflict in gradle while adding com.google.gms.google-services添加 com.google.gms.google-services 时 gradle 中的版本冲突
【发布时间】:2017-03-15 19:43:38
【问题描述】:

我正在使用助手向我的项目添加 firebase 云消息传递,在 android studio 构建项目时遇到以下错误消息:

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

这里是构建文件:

顶级:

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

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

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

allprojects {  
    repositories {  
        jcenter()  
    }  
}  

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

应用级:

apply plugin: 'com.android.application'  

android {  
        compileSdkVersion 25  
        buildToolsVersion "25.0.0"  
        defaultConfig {  
        applicationId "in.ac.iitb.treeplantationapp"  
        minSdkVersion 21  
        targetSdkVersion 25  
        versionCode 1  
        versionName "1.0"  
        testInstrumentationRunner   "android.support.test.runner.AndroidJUnitRunner"  
    }  
    buildTypes {  
        release {  
            minifyEnabled false  
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
        }  
    }  
}  

dependencies {  
    compile fileTree(dir: 'libs', include: ['*.jar'])  
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {  
        exclude group: 'com.android.support', module: 'support-annotations'
    })  

    compile 'com.android.support:appcompat-v7:25.0.1'  
    compile 'com.android.volley:volley:1.0.0'  
    compile 'com.android.support:design:25.0.1'  
    compile 'com.google.android.gms:play-services-appindexing:9.8.0'  
    compile 'com.google.android.gms:play-services:10.0.0'  
    compile 'com.squareup.picasso:picasso:2.5.2'  
    compile 'com.google.firebase:firebase-messaging:10.0.1'  
    testCompile 'junit:junit:4.12'  
}  


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

【问题讨论】:

  • 在 sdk 工具中更新您的 google 存储库

标签: android android-gradle-plugin build.gradle


【解决方案1】:

您正在使用 不同版本的 google play 服务:

compile 'com.google.android.gms:play-services-appindexing:9.8.0'  
compile 'com.google.android.gms:play-services:10.0.0'
compile 'com.google.firebase:firebase-messaging:10.0.1'    

用途:

compile 'com.google.android.gms:play-services-appindexing:10.0.1'  
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'    

【讨论】:

    猜你喜欢
    • 2017-11-06
    • 1970-01-01
    • 1970-01-01
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多