Get started with Firebase Crashlytics


This quickstart describes how to set up Firebase Crashlytics in your app with the Crashlytics Flutter plugin so that you can get comprehensive crash reports in the Firebase console.

Setting up Crashlytics involves using both a command-line tool and your IDE. To finish setup, you'll need to force a test exception to be thrown to send your first crash report to Firebase.

Before you begin

  1. If you haven't already, configure and initialize Firebase in your Flutter project.

  2. Recommended: To automatically get breadcrumb logs to understand user actions leading up to a crash, non-fatal, or ANR event, you need to enable Google Analytics in your Firebase project.

    • If your existing Firebase project doesn't have Google Analytics enabled, you can enable Google Analytics from the Integrations tab of your > Project settings in the Firebase console.

    • If you're creating a new Firebase project, enable Google Analytics during the project creation workflow.

    Note that breadcrumb logs are available for all Android and Apple platforms supported by Crashlytics (except watchOS).

Step 1: Add Crashlytics to your Flutter project

  1. From the root of your Flutter project, run the following command to install the Flutter plugin for Crashlytics .

    To take advantage of breadcrumb logs , also add the Flutter plugin for Google Analytics to your app. Make sure that Google Analytics is enabled in your Firebase project.

     flutter  
    pub  
    add  
    firebase_crashlytics && 
    flutter  
    pub  
    add  
    firebase_analytics 
    
  2. From the root directory of your Flutter project, run the following command:

     flutterfire  
    configure 
    

    Running this command ensures that your Flutter app's Firebase configuration is up-to-date and, for Android, adds the required Crashlytics Gradle plugin to your app.

  3. Once complete, rebuild your Flutter project:

     flutter  
    run 
    
  4. (Optional) If your Flutter project uses the --split-debug-info flag (and, optionally, also the --obfuscate flag), additional steps are required to show readable stack traces for your apps.

    • Apple platforms:Make sure that your project is using the recommended version configuration (Flutter 3.12.0+ and Crashlytics Flutter plugin 3.3.4+) so that your project can automatically generate and upload Flutter symbols (dSYM files) to Crashlytics .

    • Android:Use the Firebase CLI (v.11.9.0+) to upload Flutter debug symbols. You need to upload the debug symbols before reporting a crash from an obfuscated code build.

      From the root directory of your Flutter project, run the following command:

      firebase crashlytics:symbols:upload --app= FIREBASE_APP_ID 
       PATH/TO 
      /symbols
      • FIREBASE_APP_ID : Your Firebase Android App ID (not your package name)
        Example Firebase Android App ID: 1:567383003300:android:17104a2ced0c9b9b

        Need to find your Firebase App ID?

        Here are two ways to find your Firebase App ID:

        • In your google-services.json file, your App ID is the mobilesdk_app_id value; or

        • In the Firebase console, go to your Project settings . Scroll down to the Your apps card, then click on the desired Firebase App to find its App ID.