Manifest merger failed while adding FirebaseUI library and support libraries

狂风中的少年 提交于 2019-12-02 14:13:25

问题


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.

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.

Below is my gradle files

1.project module

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,module app

    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'

回答1:


Add this line inside your application tag in the manifest

 <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
        tools:replace="android:value" />

exactly as it shows above. This is not your integer directory it is an Android directory.




回答2:


You can find in the official doc:

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.

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"


来源:https://stackoverflow.com/questions/46493996/manifest-merger-failed-while-adding-firebaseui-library-and-support-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!