---
title: "Crashlytics Integration"
description: "Tag Crashlytics reports with the Shorebird patch number, so you can tell which patch a crash came from."
---

Crashlytics reports crashes from Shorebird releases and patches with no extra setup. If you have multiple patches, it can be unclear which patch caused the crash. This document shows how you can use Crashlytics to differentiate between patches.

If you build with `--obfuscate` or `--split-debug-info`, Crashlytics can’t show names for Dart frames in a patch’s code. See [Reading crashes from patches](/code-push/crash-reporting/uploading-symbols/#reading-crashes-from-patches).

To see readable native engine frames, upload Shorebird’s engine symbols to Crashlytics (on Android, this also requires NDK crash reporting). If you build with `--obfuscate` or `--split-debug-info`, Dart frames also need the Dart symbols from that build. These are separate uploads. See [Uploading Symbols](/code-push/crash-reporting/uploading-symbols).

If crashes start after a patch installs, see [App crashes after a patch installs](/code-push/troubleshooting/#app-crashes-after-a-patch-installs).

## Add the `shorebird_code_push` package to your project.

[shorebird\_code\_push](https://pub.dev/packages/shorebird_code_push) is available on pub.dev and lets you programmatically determine your app’s current patch number. To add it to your project, follow the instructions on the package’s pub.dev page.

## Configure Crashlytics

If you haven’t already, follow the Crashlytics [getting started with Flutter](https://firebase.google.com/docs/crashlytics/get-started?platform=flutter) guide.

Update the Firebase init code to include the patch number as a custom key. This will look something like:

```
Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );

  final patch = await ShorebirdUpdater().readCurrentPatch();

  // Add the patch number as a tag. You can use whatever name you would like
  // as the key. `$patch` will be "null" if there is no patch. You may
  // wish to handle this case differently.
  FirebaseCrashlytics.instance.setCustomKey(
    'shorebird_patch_number',
    '${patch?.number}',
  );
  runApp(const MyApp());
}
```
