Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hyvong-iclic opened this issue Aug 17, 2023 · 2 comments
Open

Comments

@hyvong-iclic
Copy link

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');
});
@nicolapiccoli
Copy link

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

@hyvong-iclic
Copy link
Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants