capacitor-firebase-analytics
capacitor-firebase-analytics copied to clipboard
"Manifest merger failed" error in Android Studio
In the project level build.gradle file, if you add the following line as Google recommend in their setup instructions:
implementation 'com.google.firebase:firebase-core:17.0.0'
Then at runtime you get an 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:5:5-43:19 to override.
This is because the build.gradle generated by Ionic already has this line in it:
implementation 'com.android.support:appcompat-v7:28.0.0'
You don't need to (in fact, can't) add implementation 'com.google.firebase:firebase-core:17.0.0'
It might be worth noting that in the installation instructions.
Thank you @AndrWeisR for highlighting this. It was a roadblock for me otherwise!