如何使用Firebase(Crashlytics)记录非致命(捕获)异常 [英] How to log non-fatal (caught) exceptions with Firebase (Crashlytics)
问题描述
我开始在项目中使用Firebase(Crashlytics)来跟踪应用程序崩溃.它非常适合崩溃,但如何记录非致命崩溃(即捕获的异常).我尝试了Crashlytics.logException(e)
,但是它不起作用.我在仪表板上看不到任何报告.我看到了建议使用FirebaseCrash.report(t)
的答案,但最新版本的Firebase中不存在此类.那么有人知道它是怎么做的吗?
依存关系
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
使用新的Firebase Crashlytics,您应该使用recordException(@NonNull Throwable throwable)
...
catch (e: Exception) {
FirebaseCrashlytics.getInstance().recordException(e)
}
...
以下是 firebase文档 >
I started using Firebase (Crashlytics) in my project to track app crashes. It works perfectly with crashes but how can I log non-fatal crashes, i.e. caught exceptions. I tried Crashlytics.logException(e)
but it doesn't work. I see no reports in the dashboard. I saw answers suggesting to use FirebaseCrash.report(t)
but this class doesn't exist in the latest version of Firebase. So does anyone know how it's done?
Dependecies
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
With the new Firebase Crashlytics you should use recordException(@NonNull Throwable throwable)
...
catch (e: Exception) {
FirebaseCrashlytics.getInstance().recordException(e)
}
...
Here is firebase documentation stating that
这篇关于如何使用Firebase(Crashlytics)记录非致命(捕获)异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!