firebase icon indicating copy to clipboard operation
firebase copied to clipboard

[firebase-crashlytics] Fatal errors aren't sent to Firebase console

Open hyvong-iclic opened this issue 2 years ago • 2 comments

Description

On Android, crashing the application with firebase().crashlytics().crash() at launch or on tap of a button doesn't seem to create a report and send it to the Firebase console. However, non-fatal errors registered using recordError() are logged. Only fatal errors alone are not.

I tried using an emulator as well as a real device.

I didn't encounter this problem on iOS.

I used adb -d shell setprop log.tag.FirebaseCrashlytics DEBUG in order to debug with Android Studio Logcat window.

LOGCAT

When launching the app:

I  Initializing Firebase Crashlytics 18.3.5 for [my_app]
D  Crashlytics automatic data collection ENABLED by API.
D  AnalyticsConnector now available.
D  Registered Firebase Analytics listener.
D  Could not find resources: 0 0 0
D  Mapping file ID is: 00000000000000000000000000000000
D  Checking for cached settings...
D  Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false,"collect_anrs":true,"collect_metric_kit":false,"collect_build_ids":true},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"[my_org_id]","bundle_id":"[my_app]"},"on_demand_upload_rate_per_minute":10,"on_demand_backoff_base":1.2,"on_demand_backoff_step_duration_seconds":60,"app_quality":{"sessions_enabled":true,"sampling_rate":1,"session_timeout_seconds":1800},"expires_at":1692371612723}
D  Crashlytics automatic data collection ENABLED by API.
D  Opening a new session with ID 64DE3B9F0282000141206C187BCC6F6F
D  Successfully configured exception handler.
D  Registered Firebase Analytics event receiver for breadcrumbs
D  Loaded userId d9cca353b92f4809 for session 64DE3AE602DD00013EC409DA663282C6
D  Crashlytics automatic data collection ENABLED by API.

Then, I immediatly click on the crash test button:

E  FATAL EXCEPTION: main
      Process: [my_app], PID: 16672
      java.lang.RuntimeException: Crash Test
       at org.nativescript.firebase.crashlytics.FirebaseCrashlytics$Companion.crash$lambda-12(FirebaseCrashlytics.kt:70)
       at org.nativescript.firebase.crashlytics.FirebaseCrashlytics$Companion.$r8$lambda$OnmfIXby3H6SMwJX2zdCZGh29Ek(Unknown Source:0)
       at org.nativescript.firebase.crashlytics.FirebaseCrashlytics$Companion$$ExternalSyntheticLambda0.run(Unknown Source:0)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7952)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)
W  	at org.nativescript.firebase.crashlytics.FirebaseCrashlytics$Companion.crash$lambda-12(FirebaseCrashlytics.kt:70)
W  	at org.nativescript.firebase.crashlytics.FirebaseCrashlytics$Companion.$r8$lambda$OnmfIXby3H6SMwJX2zdCZGh29Ek(Unknown Source:0)
W  	at org.nativescript.firebase.crashlytics.FirebaseCrashlytics$Companion$$ExternalSyntheticLambda0.run(Unknown Source:0)

This follows right after the RuntimeException occured and the error screen on in the app is still visible:

I  Initializing Firebase Crashlytics 18.3.5 for [my_app]
D  Crashlytics automatic data collection ENABLED by API.
D  AnalyticsConnector now available.
D  Registered Firebase Analytics listener.
D  Could not find resources: 0 0 0
D  Mapping file ID is: 00000000000000000000000000000000
D  Checking for cached settings...
D  Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false,"collect_anrs":true,"collect_metric_kit":false,"collect_build_ids":true},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"[my_org_id]","bundle_id":"[my_app]"},"on_demand_upload_rate_per_minute":10,"on_demand_backoff_base":1.2,"on_demand_backoff_step_duration_seconds":60,"app_quality":{"sessions_enabled":true,"sampling_rate":1,"session_timeout_seconds":1800},"expires_at":1692371612723}
D  Crashlytics automatic data collection ENABLED by API.
D  Opening a new session with ID 64DE3BAD0399000142166C187BCC6F6F
D  Successfully configured exception handler.
D  Registered Firebase Analytics event receiver for breadcrumbs
D  Loaded userId d9cca353b92f4809 for session 64DE3B9F0282000141206C187BCC6F6F

When I restart the app:

 I  Initializing Firebase Crashlytics 18.3.5 for [my_app]
D  Crashlytics automatic data collection ENABLED by API.
D  AnalyticsConnector now available.
D  Registered Firebase Analytics listener.
D  Could not find resources: 0 0 0
D  Mapping file ID is: 00000000000000000000000000000000
D  Checking for cached settings...
D  Loaded cached settings: {"settings_version":3,"cache_duration":86400,"features":{"collect_logged_exceptions":true,"collect_reports":true,"collect_analytics":false,"prompt_enabled":false,"push_enabled":false,"firebase_crashlytics_enabled":false,"collect_anrs":true,"collect_metric_kit":false,"collect_build_ids":true},"app":{"status":"activated","update_required":false,"report_upload_variant":2,"native_report_upload_variant":2},"fabric":{"org_id":"[my_org_id]","bundle_id":"[my_app]"},"on_demand_upload_rate_per_minute":10,"on_demand_backoff_base":1.2,"on_demand_backoff_step_duration_seconds":60,"app_quality":{"sessions_enabled":true,"sampling_rate":1,"session_timeout_seconds":1800},"expires_at":1692371612723}
D  Crashlytics automatic data collection ENABLED by API.
D  Opening a new session with ID 64DE3BBC002C000142806C187BCC6F6F
D  Successfully configured exception handler.
D  Registered Firebase Analytics event receiver for breadcrumbs
D  No userId set for session 64DE3BAD0399000142166C187BCC6F6F
D  Crashlytics automatic data collection ENABLED by API.

I noticed the user ID is missing when I restart the app. I don't know if it matters in this situation.

My app configuration (in app.ts):

firebase().initializeApp().then(() => {
  
  // other configurations for firebase modules

  //Crashlytics
  firebase().crashlytics().setUserId(device.uuid);
  firebase().crashlytics().setCrashlyticsCollectionEnabled(true);
  firebase().crashlytics().log('App started');
});

hyvong-iclic avatar Aug 17 '23 16:08 hyvong-iclic

Same problem. It works with iOS, doesn't with Android. @hyvong-iclic Did you find any reason/solution to this?

nicolapiccoli avatar Nov 13 '23 10:11 nicolapiccoli

@nicolapiccoli I didn't really find a solution, but I think it is because my app was running in debug mode at this time. When the app was finally pushed to the play store, crashes were properly sent.

You can try building the app in release with ns run android --release and check if that works for you too.

hyvong-iclic avatar Nov 13 '23 13:11 hyvong-iclic