24

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?

fogx
  • 1,749
  • 2
  • 16
  • 38

8 Answers8

48

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

fogx
  • 1,749
  • 2
  • 16
  • 38
26

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"
Sanjay
  • 127
  • 7
Mohebifar
  • 3,341
  • 1
  • 24
  • 32
18

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.

Sachin Kumar
  • 887
  • 1
  • 7
  • 17
Swetabja Hazra
  • 664
  • 7
  • 14
1

add this line at the end of app level gradle file

apply plugin: 'com.google.gms.google-services'
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Syyam Noor
  • 67
  • 10
0

I was able to solve by hoovering over compile 'com.android.support:appcompat-v7:26.0.0' and adding the libraries manually that it said was wrong such as

compile 'com.android.support:cardview-v7:26.0.0'
compile 'com.android.support:animated-vector-drawable:26.0.0'
compile 'com.android.support:customtabs:26.0.0'
0

add this line to your manifest

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

exactly as shown inside the "application" tag.

Sam
  • 5,342
  • 1
  • 23
  • 39
  • 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. – Sam Nov 14 '17 at 18:45
0

This type of error has come up because of different libraries added by you. While adding libraries make sure that all of them are of the same version and work flawlessly with one another.

Sachin Kumar
  • 887
  • 1
  • 7
  • 17
  • 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) – fogx Dec 27 '18 at 13:30
0

It occurs when you use different versions of the same library for implementation in the build.gradle of app module. You can solve this by implementing same versions of a library.

If the problem still persists then add the following code at the end of build.gradle(app module)

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