1

Updated the firebase cloud messaging Gradle file version from 17.4.0 to 19.0.1 failed with Gradle build issue

implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-core:17.0.0'

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:70:5-482:19 to override.```

Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53
Rohini
  • 21
  • 5

3 Answers3

1

You are having problem with dependencies that do not depend on AndroidX. See about migration to AndroidX here.

Explanation: You have some dependency that depends on android support (Old, deprecated), and some dependency that depends on AndroidX. So there is a conflict when merging them. Force your dependencies to use AndroidX by adding the following to your gradle.properties file:

android.useAndroidX=true
android.enableJetifier=true

Also,

With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.

Now, see this: Firebase release notes and mention to AndroidX. The official docs that state you need to use AndroidX in these versions.

Edit, just to add a reminder:

Whenever updating dependencies, specially a major version (the first, most significant number on the version code), read the release-notes. Even more if you are dealing with an already released software. This might save some lives.

Vitor Hugo Schwaab
  • 1,545
  • 20
  • 31
  • 2
    Maybe emphasize that your first link makes reference to the 'Refactor | Migrate to Android X' menu option to perform the migration in a single-click. –  Jul 09 '19 at 14:33
0

You can find detailed error log about your merge issue if you select your manifest file in your project folder then change the bottom tab to "Merge Manifest".

Maybe it can help you to find out more. See attachment.

enter image description here

Imran
  • 5,542
  • 3
  • 23
  • 46
0

You cant have a support library and an androidx library. You must either convert to androidx or remove your androidx libs and use normal libs.

Chris Papantonis
  • 720
  • 7
  • 18