Customize your Firebase Crashlytics crash reports

In the Crashlytics dashboard, you can click into an issue and get a detailed event report. You can customize those reports to help you better understand what's happening in your app and the circumstances around events reported to Crashlytics.

  • Automatically get breadcrumb logs if your app uses the Firebase SDK for Google Analytics. These logs give you visibility into user actions leading up to a Crashlytics-collected event in your app.

  • Turn off automatic crash reporting and enable opt-in reporting for your users. Note that, by default, Crashlytics automatically collects crash reports for all your app's users.

Report exceptions

Report caught exceptions

If you have exceptions that are expected, you can have the Crashlytics SDK report them as non-fatal events. These events are logged on device and then sent along with the next fatal event report or when the end-user restarts the game.

You can log exceptions in C# using the following method:

Crashlytics.LogException(Exception ex);

You can log expected exceptions in your game's try/catch blocks:

try {
    myMethodThatThrows();
} catch (Exception e) {
   Crashlytics.LogException(e);
   // handle your exception here!
}

Report uncaught exceptions

For uncaught exceptions that don't crash your game (for example, uncaught C# exceptions in game logic), you can have the Crashlytics SDK report them as fatal events by setting the Crashlytics.ReportUncaughtExceptionsAsFatal property to true where you initialize Crashlytics in your Unity project . These events are reported to Crashlytics in real-time without the need for the end-user to restart the game.

Reporting these uncaught exceptions as fatal events means that they'll count in your crash-free user statistics and towards velocity alerts.

Note that native crashes are always reported as fatal events. These events are logged on device and then sent along when the end-user restarts the game.

void Start() {
    // Since there is no try-block surrounding this call, if an exception is thrown,
    // it is considered unexpected.
    // Setting `Crashlytics.ReportUncaughtExceptionsAsFatal = true`
    // will ensure that such cases are reported as fatals.
    thirdPartyMethodThatMayThrow();
}

Include GWP-ASan reports to debug memory corruption issues

For Android apps that use IL2CPP, Crashlytics can help you debug crashes caused by native memory errors by collecting GWP-ASan reports. These memory-related errors can be associated with memory corruption within your app, which is the leading cause of app security vulnerabilities.

  • You can view this data in a new "Memory stack traces" tab when you click into an issue's details in the Crashlytics dashboard.

  • You can also use the new "GWP-ASan report" signal and filter to quickly view all issues with this data.

You can get GWP-ASan memory reports if your app uses the latest Crashlytics SDK for Unity (v10.7.0+) and has GWP-ASan explicitly enabled (requires you to modify your Android App Manifest). If you have any C++ code in your app, you can test your GWP-ASan setup using the example native code in the Android documentation.

Add custom keys

Custom keys help you get the specific state of your app leading up to a crash. You can associate arbitrary key/value pairs with your crash reports, then use the custom keys to search and filter crash reports in the Firebase console.

  • In the Crashlytics dashboard, you can search for issues that match a custom key.
  • When you're reviewing a specific issue in the console, you can view the associated custom keys for each event (Keys subtab) and even filter the events by custom keys (Filter menu at the top of the page).

When called multiple times, new values for existing keys will update the value, and only the most current value is captured when a crash is recorded.

Crashlytics.SetCustomKey(string key, string value);

Add custom log messages

Logged messages are associated with your crash data and are visible in the Firebase Crashlytics dashboard when viewing a specific crash.

Crashlytics.Log(string message);

Set user identifiers

You can use an ID number, token, or hashed value to uniquely identify the end-user of your application without disclosing or transmitting any of their personal information. You can also clear the value by setting it to a blank string. This value is displayed in the Firebase Crashlytics dashboard when viewing a specific crash.

Crashlytics.SetUserId(string identifier);

Get breadcrumb logs

Breadcrumb logs give you a better understanding of the interactions that a user had with your app leading up to a crash, non-fatal, or ANR event. These logs can be helpful when trying to reproduce and debug an issue.

Breadcrumb logs are powered by Google Analytics, so to get breadcrumb logs, you need to enable Google Analytics for your Firebase project and add the Firebase SDK for Google Analytics to your app. Once these requirements are met, breadcrumb logs are automatically included with an event's data within the Logs tab when you view the details of an issue.

The Analytics SDK automatically logs the screen_view event which enables the breadcrumb logs to show a list of screens viewed before the crash, non-fatal, or ANR event. A screen_view breadcrumb log contains a firebase_screen_class parameter.

Breadcrumb logs are also populated with any custom events that you manually log within the user’s session, including the event's parameter data. This data can help show a series of user actions leading up to a crash, non-fatal, or ANR event.

Note that you can control the collection and use of Google Analytics data, which includes the data that populates breadcrumb logs.

Enable opt-in reporting

By default, Crashlytics automatically collects crash reports for all your app's users. You can give users more control over the data they send by letting them opt-in to reporting crashes.

To disable automatic collection and initialize Crashlytics only for selected users, call the Crashlytics data collection override at runtime. The override value persists across launches of your app so Crashlytics can automatically collect reports. To opt out of automatic crash reporting, pass false as the override value. When set to false, the new value does not apply until the next run of the app.

Crashlytics.IsCrashlyticsCollectionEnabled = true

Manage Crash Insights data

Crash Insights helps you resolve issues by comparing your anonymized stack traces to traces from other Firebase apps and letting you know if your issue is part of a larger trend. For many issues, Crash Insights even provides resources to help you debug the crash.

Crash Insights uses aggregated crash data to identify common stability trends. If you’d prefer not to share your app's data, you can opt-out of Crash Insights from the Crash Insights menu at the top of your Crashlytics issue list in the Firebase console.