Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Adding Firebase Messaging - Menifest merger failed

Tags:

android

I added this to my project:

implementation 'com.google.firebase:firebase-messaging:19.0.0'

and result:

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:15:5-71:19 to override.

So I go went ahead and added that line to the manifest, and I get this:

 Manifest merger failed with multiple errors, see logs

I went to merging errors, and I see this now:

Error: tools:replace specified at line:15 for attribute android:appComponentFactory, but no new value specified app main manifest (this file), line 14

Here are my current gradle dependencies:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation project(path: ':bluefire-api-v25.5')
    implementation "com.jakewharton:butterknife:8.5.1"
    annotationProcessor "com.jakewharton:butterknife-compiler:8.8.1"
    implementation 'com.myhexaville:smart-image-picker:1.0.4'
    implementation 'com.github.gcacace:signature-pad:1.2.1'

    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'

    implementation 'com.android.support:recyclerview-v7:28.0.0'

    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:19.0.0'
}

I hit a dead-end. Thoughts?

like image 789
svguerin3 Avatar asked Jun 27 '19 04:06

svguerin3


Video Answer


1 Answers

To troubleshoot your problem, Follow below steps:

  • Open your AndroidManifest.xml
  • There is a tab on the bottom of the Ide named "Merged Manifest". Open it.
  • This will list out the Merged Manifest at the left and their sources at right.

  • As you are facing Manifest "merger failed" error, you will see Some Merging Errors.

  • This will tell you exactly which part is in conflict. Resolve that and you are done.

In your case, the error is because of the conflict between different support libraries. i.e. between androidx and older support lib. Migrate all your support library to AndroidX. The latest firebase library you are using is already migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries.

This post will help you to migrate to AndroidX : Migrating to AndroidX

like image 175
Deˣ Avatar answered Oct 27 '22 11:10

Deˣ