Save the date - Google I/O returns May 18-20. Register to get the most out of the digital experience: Build your schedule, reserve space, participate in Q&As, earn Google Developer profile badges, and more. Register now

Get started with Firebase Crashlytics

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

Before you begin

  1. If you haven't already, add Firebase to your Android project. If you don't have an Android app, you can download a sample app.

  2. Recommended: To get features like crash-free users, breadcrumb logs, and velocity alerts, 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.

Step 1: Set up Crashlytics in the Firebase console

  1. Click Crashlytics in the left-hand nav panel of the Firebase console.

  2. If your Firebase project has multiple apps registered in it, select the app you just added from the dropdown next to Crashlytics in the top bar of the console.

  3. Click Enable Crashlytics.

Step 2: Add the Firebase Crashlytics plugin to your app

  1. In your project-level build.gradle file, add the Crashlytics Gradle plugin as a buildscript dependency.
    buildscript {
        repositories {
            // Check that you have Google's Maven repository (if not, add it).
            google()
        }
    
        dependencies {
            // ...
    
            // Check that you have the Google Services Gradle plugin v4.3.2 or later
            // (if not, add it).
            classpath 'com.google.gms:google-services:4.3.6'
    
            // Add the Crashlytics Gradle plugin (be sure to add version
            // 2.0.0 or later if you built your app with Android Studio 4.1).
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.0'
        }
    }
    
    allprojects {
        repositories {
            // Check that you have Google's Maven repository (if not, add it).
            google()
        }
    }
       
  2. In your app-level build.gradle file, apply the Crashlytics Gradle plugin:
    apply plugin: 'com.android.application'
    
    apply plugin: 'com.google.gms.google-services' // Google Services Gradle plugin
    
    // Apply the Crashlytics Gradle plugin
    apply plugin: 'com.google.firebase.crashlytics'
        

Step 3: Add the Firebase Crashlytics SDK to your app

  1. Using the Firebase Android BoM, declare the dependency for the Crashlytics Android library in your module (app-level) Gradle file (usually app/build.gradle).

    For an optimal experience with Crashlytics, we recommend enabling Google Analytics in your project. Also, as part of setting up Analytics, you need to add the Firebase SDK for Google Analytics to your app.

    Java

    dependencies {
        // Import the BoM for the Firebase platform
        implementation platform('com.google.firebase:firebase-bom:28.0.0')
    
        // Declare the dependencies for the Crashlytics and Analytics libraries
        // When using the BoM, you don't specify versions in Firebase library dependencies
        implementation 'com.google.firebase:firebase-crashlytics'
        implementation 'com.google.firebase:firebase-analytics'
    }
    

    By using the Firebase Android BoM, your app will always use compatible versions of the Firebase Android libraries.

    (Alternative) Declare Firebase library dependencies without using the BoM

    If you choose not to use the Firebase BoM, you must specify each Firebase library version in its dependency line.

    Note that if you use multiple Firebase libraries in your app, we highly recommend using the BoM to manage library versions, which ensures that all versions are compatible.

    dependencies {
        // Declare the dependencies for the Crashlytics and Analytics libraries
        // When NOT using the BoM, you must specify versions in Firebase library dependencies
        implementation 'com.google.firebase:firebase-crashlytics:18.0.0'
        implementation 'com.google.firebase:firebase-analytics:19.0.0'
    }
    

    Kotlin+KTX

    dependencies {
        // Import the BoM for the Firebase platform
        implementation platform('com.google.firebase:firebase-bom:28.0.0')
    
        // Declare the dependencies for the Crashlytics and Analytics libraries
        // When using the BoM, you don't specify versions in Firebase library dependencies
        implementation 'com.google.firebase:firebase-crashlytics-ktx'
        implementation 'com.google.firebase:firebase-analytics-ktx'
    }
    

    By using the Firebase Android BoM, your app will always use compatible versions of the Firebase Android libraries.

    (Alternative) Declare Firebase library dependencies without using the BoM

    If you choose not to use the Firebase BoM, you must specify each Firebase library version in its dependency line.

    Note that if you use multiple Firebase libraries in your app, we highly recommend using the BoM to manage library versions, which ensures that all versions are compatible.

    dependencies {
        // Declare the dependencies for the Crashlytics and Analytics libraries
        // When NOT using the BoM, you must specify versions in Firebase library dependencies
        implementation 'com.google.firebase:firebase-crashlytics-ktx:18.0.0'
        implementation 'com.google.firebase:firebase-analytics-ktx:19.0.0'
    }
    

  2. Optional: Firebase Crashlytics offers crash reporting for apps built using the Android Native Development Kit (NDK). If your app uses the NDK, you can configure Crashlytics to report crashes that occur in your app's underlying NDK libraries. Visit the NDK crash reporting documentation to learn how.

Step 4: Run your project

Finally, run your app. Your device logs display the Firebase verification that initialization is complete.

Step 5: Force a test crash to finish setup

To finish setting up Crashlytics and see initial data in the Crashlytics dashboard of the Firebase console, you need to force a test crash.

For details about how to do this, visit Test your implementation.

Next steps