与firebase-core冲突:11.8.0' ' com.google.gms:谷歌服务:3.2.0

时间:2018-03-18 18:31:43

标签: android dependencies firebase-authentication

版本冲突是通过更新google-services插件的版本或将com.google.android.gms的版本更新为11.0.4。 我尝试了这个(Conflict with firebase 11.8.0 and google-services plugin 3.1.2)解决方案,但失败了

Messages Gradle Build

build.Gradle(Project Level)

build.Gradle(App level)

应用级代码

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.shadow.pakistannetcafe"
        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'
        }
    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    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.0.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:support-v4:26.0.2'

    compile 'com.google.firebase:firebase-core:11.8.0'
    compile 'com.google.firebase:firebase-messaging:11.8.0'
    compile 'com.google.firebase:firebase-auth:9.2.1'

    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

项目级别Gradle

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

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

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

allprojects {
    repositories {
        jcenter()
        google()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

1 个答案:

答案 0 :(得分:0)

保留所有firebase依赖项相同的版本,以便使用(在app-level gradle中)

 compile 'com.google.firebase:firebase-auth:11.8.0'

而不是

 compile 'com.google.firebase:firebase-auth:9.2.1'