Get started with Firebase Crashlytics

This quickstart shows you how to set up Firebase Crashlytics so you can get comprehensive crash reports in the Firebase console.

ios
android

Before you begin

ios

To get started, you need a Firebase app with Firebase Crashlytics enabled:

android

To get started, you need a Firebase app with Firebase Crashlytics enabled:

Add the Crashlytics SDK to your project

ios

Add Crashlytics frameworks to your Xcode workspace

To get started, add the Crashlytics SDK framework files to your project. For most projects, the easiest way to do that is by adding the Crashlytics CocoaPods, but, if your project can't support CocoaPods, you can also add the files manually.

Add the Crashlytics run script

The frameworks you added include a run script that initializes Crashlytics. Add it to your project's build phases:

  1. Open your project in Xcode, and select its project file in the Navigator.
  2. Select your main build target from the Select a project or target dropdown.
  3. Open the target's Build Phases tab.
  4. Click + Add a new build phase, and select New Run Script Phase.
  5. Add the following line to the Type a script... text box:
    CocoaPods install
    "${PODS_ROOT}/Fabric/run"
    Manual install
    "${PROJECT_DIR}/Fabric.framework/run"
  6. Xcode 10 only: Add your app's built Info.plist location to the Build Phase's Input Files field:
    $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

Once you've added the SDK to your app, Crashlytics automatically gets to work listening for and collecting crash reports.

Note: Make sure your new build phase is the project's last build phase, otherwise Crashlytics won't initialize properly.
android

Include the SDK in your build files

  1. Add the Crashlytics repositories and dependency to your project-level build.gradle file:
    buildscript {
        repositories {
            // ...
            maven {
               url 'https://maven.fabric.io/public'
            }
        }
        dependencies {
            // ...
            classpath 'io.fabric.tools:gradle:1.25.4'
        }
    }
    
    allprojects { // ... repositories { // ... maven { url 'https://maven.google.com/' } } }
  2. Note: Crashlytics requires Google Services plugin version 3.1.2 or higher. Check the com.google.gms:google-services version number in your project's build.gradle dependencies.
  3. Add the Crashlytics dependencies to your app-level build.gradle:
    apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'
    
    dependencies { // ... implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3' }
Note: For full functionality, Crashlytics requires use of firebase-core version 11.4.2 or greater.

Once you've added the SDK to your app, Crashlytics automatically gets to work listening for and collecting crash reports.

Next steps

  • Test your implementation—test your Crashlytics setup by forcing a crash to generate a crash report in the Firebase console.

  • Customize crash reports—Crashlytics automatically starts collecting crash reports as soon as you add the SDK, but you can also customize your setup by adding opt-in reporting, logs, keys, and even tracking non-fatal errors.

Şunun hakkında geri bildirim gönderin...

Yardım mı gerekiyor? Destek sayfamızı ziyaret edin.