Problem with adding firebase crashlytics android

Viewed 980

I have added this lines to project level gradle file:

classpath 'com.google.gms:google-services:4.3.2'
classpath 'io.fabric.tools:gradle:1.31.1'

then these lines at app gradle files:

apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'

and these lines as well

implementation 'com.google.firebase:firebase-core:<version>'
implementation 'com.crashlytics.sdk.android:crashlytics:<version>'

and I received 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:17:5-64:19 to override.

then I tried to fix this error by adding this line to manifest:

tools:replace="android:appComponentFactory"

but this line didn't help me. Maybe someone knows how to add firebase crashlytics support to my android app? Where I made an error?

2 Answers

This is because you are using the new Material library with the legacy Support Library. You have to migrate android.support to androidx in order to use com.google.android.material.

add below line in gradle file and try

implementation 'com.google.android.material:material:1.0.0'
Related