Get started with Firebase Crashlytics using the Firebase Crashlytics SDK

This quickstart describes how to set up Firebase Crashlytics in your app for the first time using the Firebase Crashlytics SDK so you can get comprehensive crash reports in the Firebase console. Note that the SDK is currently in beta, so if you prefer to use a more stable version, you can set up Crashlytics using the legacy Fabric SDK instead.

Before you begin

  • Skip this step if your app already uses Firebase: First, add Firebase to your Android project. Make sure to register your app and add a Firebase configuration file (you don't need to add any Firebase SDKs yet). If you don't have an Android app, you can download a sample app.

  • The Firebase Crashlytics SDK uses AndroidX as a dependency, so if your app uses older versions of the App Support Library, migrate your app to AndroidX.

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 Set up Crashlytics.

  4. Select This app is new to Crashlytics (it doesn't have any version of the SDK).

Step 2: Add Firebase Crashlytics to your app

  1. In your project-level build.gradle file, add the Crashlytics Gradle plugin:
    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.3'
    
            // Add the Crashlytics Gradle plugin.
            classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta02'
        }
    }
    
    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 SDK dependencies

For an optimal experience with Firebase Crashlytics, we recommend adding the SDK for Google Analytics to your app in addition to the SDK for Crashlytics.

  1. In your app-level build.gradle, add dependencies for Google Analytics and Crashlytics.

    dependencies {
        // Recommended: Add the Firebase SDK for Google Analytics.
        implementation 'com.google.firebase:firebase-analytics:17.2.2'
    
        // Add the Firebase SDK for Crashlytics.
        implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
    }
    
  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.

Next steps