Upgrade to Firebase Crashlytics from Firebase Crash Reporting


Crashlytics is the new, primary crash reporter for Firebase. If your app uses Firebase Crash Reporting, there's good news: Crashlytics offers enhanced crash reporting with nearly the same setup process you're used to, so upgrading is straightforward:

  1. Update your project's dependencies.
  2. Migrate any log calls, if you have them.
  3. Set up manual initialization, if you used it.

Update project dependencies


To update your app's depencencies for Firebase Crashlytics, swap in the Crashlytics pod files and build phase script:

  1. Open your project's Podfile.
  2. Replace the Firebase Crash Reporting pod, pod 'Firebase/Crash', with the Firebase Core and Crashlytics pods:
    pod 'Firebase/Core'
    pod 'Fabric', '~> 1.9.0'
    pod 'Crashlytics', '~> 3.12.0'
  3. In your terminal, navigate to your project directory and install the pods:
    pod install
  4. Replace the Firebase Crash Reporting build phase, "${PODS_ROOT}"/FirebaseCrash/upload-sym, with the Crashlytics build phase:
  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.26.1'
    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. To update your app's depencencies for Firebase Crashlytics, make the following changes to your app-level build.gradle:
    apply plugin: 'com.android.application'
    /* Add the Fabric plugin: */
    apply plugin: 'io.fabric'
    dependencies {
        // ...
        /* Delete Crash Reporting:
        implementation 'com.google.firebase:firebase-crash:16.2.1'
        Add Crashlytics: */
        implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
        // Update your firebase-core version, if it's lower than v11.4.2
        implementation 'com.google.firebase:firebase-core:16.0.7'

Migrate logs

If you used Firebase Crash Reporting custom logs, you have to update those for Firebase Crashlytics too:

Firebase Crash Reporting Firebase Crashlytics
Objective-C Swift Objective-C & Swift
FIRCrashLog CLSLog
FIRCrashLogv CLSLogv
FIRCrashMessage FirebaseCrashMessage CLSLog
FIRCrashNSLogv FirebaseCrashNSLogv CLSNSLogv
Firebase Crash ReportingFirebase Crashlytics
FirebaseCrash.log() Crashlytics.log()
FirebaseCrash.logcat() Crashlytics.log()
FirebaseCrash.report() Crashlytics.logException()

Set up manual initialization

Like Firebase Crash Reporting, the Firebase Crashlytics SDK automatically initializes Crashlytics as soon as you add it to your app. If instead you initialize reporting manually, Crashlytics has a way to do that as well:

  1. Turn off automatic collection with a new key to your Info.plist file:
    • Key: firebase_crashlytics_collection_enabled
    • Value: false
  2. Replace the Crash Reporting initialization call with one for Crashlytics:
    /* Delete Crash Reporting:
    [FIRCrash crashCollectionEnabled:YES];
       Add Crashlytics: */
    [Fabric with:@[[Crashlytics class]]];
    /* Delete Crash Reporting:
    Crash.sharedInstance().isCrashCollectionEnabled = true
       Add Crashlytics: */
  1. Replace the Firebase Crash Reporting meta-data tag in your AndroidManifest.xml file with one for Crashlytics:
    <!-- Delete Crash Reporting:
        android:value=false />
         Add Crashlytics: -->
        android:value="false" />
  2. Replace the initialization call in relevant activities as well:


    /*   Delete Crash Reporting:
         Add Crashlytics: */
    Fabric.with(this, new Crashlytics());


    /*   Delete Crash Reporting:
         Add Crashlytics: */
    Fabric.with(this, Crashlytics())
Note: Once initialized, Crashlytics keeps reporting crashes until the user closes the app. If you want to give users the option to opt-out of reporting after you've initialized Crashlytics, they'll have to restart your app before the change can take effect.

Оставить отзыв о...

Текущей странице
Нужна помощь? Обратитесь в службу поддержки.