android manifest merger failed, gms play services / firebase

37,551

Solution 1

I solved the problem by adding:

    configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.0'
            }
        }
    }
}

from here.

The tooltip recommended adding tools:replace="android:value"' to meta-data but this throws another error, so im going with the solution above

Solution 2

I solved it by adding this in AndroidManifest.xml within the <application> tag at the very bottom:

<meta-data 
  tools:node="replace"
  android:name="android.support.VERSION"
  android:value="26.1.0"  // <- The max version you see in the error message. For me it was 26.1.0
/>

Then add these two attributes to the <manifest ... > tag:

xmlns:tools="http://schemas.android.com/tools"
tools:node="replace"

Solution 3

It's happening because two versions of support libraries are clashing. On top, you have declared

buildToolsVersion "26.0.1"

and in dependencies, the version is 26.0.0

compile 'com.android.support:design:26.0.0'

Just change the support library version to 26.0.1 and it will work fine. I did the same, worked flawlessly in my case.

Solution 4

add this line at the end of app level gradle file

apply plugin: 'com.google.gms.google-services'
Share:
37,551

Related videos on Youtube

fogx
Author by

fogx

Updated on January 24, 2020

Comments

  • fogx
    fogx over 4 years

    I am trying to add firebase to my app using the firebaseUI. As the documentations says, I have used the corresponding gms:play-services (11.0.4) with the firebaseUI version (2.2.0) When I sync the gradle files, I receive following error:

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

    This is my gradle file:

    android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    
    
    compile 'com.android.support:appcompat-v7:26.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:cardview-v7:26.0.0'
    compile 'com.android.support:support-v13:26.0.0'
    compile 'com.android.support:design:26.0.0'
    compile 'com.android.support:recyclerview-v7:26.0.0'
    
    //firebase
    compile 'com.google.android.gms:play-services-auth:11.0.4'
    compile 'com.google.firebase:firebase-core:11.0.4'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.google.firebase:firebase-database:11.0.4'
    compile 'com.google.firebase:firebase-storage:11.0.4'
    compile 'com.firebaseui:firebase-ui:2.2.0'
    
    testCompile 'junit:junit:4.12'
    }
    
    //firebase
    apply plugin: 'com.google.gms.google-services'
    

    I've made sure that all the versions are up to date and that they are all the same. Can't figure out what the problem is?

    • Nagesh Susarla
      Nagesh Susarla over 6 years
      Does adding compile 'com.android.support:customtabs:26.0.0 resolve the issue?
    • Garvit Jain
      Garvit Jain over 6 years
      No it does not resolve issue. but stackoverflow.com/a/45559003/5806017 did
  • fogx
    fogx over 6 years
    I forgot to copy the last line, it was already there (updated question)
  • McArthor Lee
    McArthor Lee over 6 years
    remember to replace "multidex" with the comment of your error log
  • Pranita
    Pranita over 6 years
    but where to add this
  • Sam
    Sam over 6 years
    Hi @Pranita unfortunately these type of errors do not have a "one size fits all" fix. That is why their are many answers to try. Try some of the other answers, hopefully you will find the right one for your situation.
  • fogx
    fogx over 5 years
    the issue is that not all libraries use the same version, even if they are the most up to date compilation. For example, the version of firebase (here 2.2.0) did not use the most up to date 26.0 google library. So if you want to use both libraries regardless, you have to use the workaround explained in the answer(s)