简体   繁体   中英

Problem with adding firebase crashlytics android

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?

This issue is happening because crashlytics already migrated to AndroidX but your app is still using Support Library.

You can find more info about how to migrate to android X here:

https://developer.android.com/jetpack/androidx/migrate

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM