NativeScript / NativeScript/firebase

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

Open
#234 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
62
Forks
53
Avg merge
8d 4h
Merged PRs (30d)
2

Description

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');
});

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Crashlytics setup in app.ts and the firebase().crashlytics().crash() call shown in the report. Reproduce the fatal crash on Android, inspect the provided Logcat output, and compare it with the working recordError() path. Done means fatal reports appear in the Firebase console after the app restarts.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, firebase, typescript
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.