android - 具有相同的gradle级别仍然会通过更新google-services插件的版本引发修复版本冲突

标签 android gradle build.gradle

我在构建gradle时遇到了这个错误

错误:任务':app: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.



尽管我所有的谷歌版本都是一样的

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

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.iviewlabs.mrmint"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

repositories {
mavenCentral()
}

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:26.+'
testCompile 'junit:junit:4.12'

compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.maps.android:android-maps-utils:0.5'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.squareup.okhttp:okhttp:2.6.0'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'id.zelory:compressor:2.1.0'
compile 'com.google.firebase:firebase-messaging:11.0.4'

}

而我的项目级别gradle是
// Top-level build file where you can add configuration options common to 
all sub-projects/modules.

buildscript {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.0'
    classpath 'com.google.gms:google-services:3.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
} 
}

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

请帮助我找到解决方案我尝试了许多解决方案

最佳答案

app中的

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

  • 在结束时添加此行,而不是在顶部添加。

    像这样:-
         dependencies {
         }
         apply plugin: 'com.google.gms.google-services' 
    

    关于android - 具有相同的gradle级别仍然会通过更新google-services插件的版本引发修复版本冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49209090/

    相关文章:

    android - 系统导航栏在某些场景下应用深色效果

    gradle - 找不到方法 lintChecks()

    java - 无法使用 Gradle 在 IntelliJ Community Edition 中添加应用程序服务器

    plugins - 应用gradle自定义jar插件

    android - 每个构建变体的不同应用程序类在某些设备上崩溃

    android-studio - 在 build.gradle 中声明依赖项后如何导入依赖项?

    gradle - 如何为默认的构建过程加载特定的build.gradle/gradle.properties

    android - Android 中蓝牙 LE 设备的最大绑定(bind)数是多少,即 'Paired Devices'?

    android - 使用 Android 将图像发送到 MySQL 数据库

    android - 修改AOSP中的关机对话框(按住电源键出现的菜单)