简体   繁体   English

添加 firebase crashlytics android 时出现问题

[英]Problem with adding firebase crashlytics android

I have added this lines to project level gradle file:我已将此行添加到项目级别 gradle 文件中:

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

then these lines at app gradle files:然后在应用程序 gradle 文件中的这些行:

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?也许有人知道如何将 firebase crashlytics 支持添加到我的 android 应用程序中? Where I made an error?我在哪里犯了错误?

This issue is happening because crashlytics already migrated to AndroidX but your app is still using Support Library.出现此问题是因为crashlytics已迁移到 AndroidX,但您的应用仍在使用支持库。

You can find more info about how to migrate to android X here:您可以在此处找到有关如何迁移到 android X 的更多信息:

https://developer.android.com/jetpack/androidx/migrate 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.您必须将 android.support 迁移到 androidx 才能使用 com.google.android.material。

add below line in gradle file and try在 gradle 文件中添加以下行并尝试

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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