添加 FirebaseUI 库和支持库时清单合并失败

添加 FirebaseUI 库和支持库时清单合并失败

问题描述:

我正在使用 google firebase 实施身份验证.我收到此错误.如果可能,请有人提出解决方案和解释,以便我理解.

I am implementing authentication using google firebase. I am getting this error . If possible please someone suggest solution along with explanation so i can understand.

错误:任务:app:processDebugManifest"的执行失败.清单合并失败:属性 meta-data#android.support.VERSION@value value=(26.0.1) from [com.android.support:design:26.0.1] AndroidManifest.xml:28:13-35也存在于 [com.android.support:appcompat-v7:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).建议:在AndroidManifest.xml:26:9-28:38的元素中添加'tools:replace="android:value"'来覆盖.

Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.1) from [com.android.support:design:26.0.1] AndroidManifest.xml:28:13-35 is also present at [com.android.support:appcompat-v7:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.

下面是我的gradle文件

Below is my gradle files

1.项目模块

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        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"
        }
    }
}

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

2、模块应用

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.example.prerak.final_audio_streamer"
        minSdkVersion 19
        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 {
    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.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-ads:11.4.0'//advertisements

    compile 'com.firebaseui:firebase-ui-auth:2.4.0'// FirebaseUI Auth only
    compile'com.google.firebase:firebase-auth:11.4.0'//firebase auth
    compile 'com.google.android.gms:play-services:11.4.0'//playservice


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

您可以在 官方文档:

如果您想使用较新版本的 FirebaseUI 传递依赖项之一,例如 Firebase、Play 服务或 Android 支持库,您需要在 build.gradle 中为所有您要使用的版本的 FirebaseUI 依赖项.

If you would like to use a newer version of one of FirebaseUI's transitive dependencies, such as Firebase, Play services, or the Android support libraries, you need to add explicit compile declarations in your build.gradle for all of FirebaseUI's dependencies at the version you want to use.

对于身份验证,您必须在 build.gradle 中添加这些行:

For Auth you have to add these lines in your build.gradle:

compile "com.android.support:design:26.1.0"
compile 'com.android.support:appcompat-v7:26.1.0'
compile "com.android.support:customtabs:26.1.0"
compile "com.android.support:cardview-v7:26.1.0"