Crashlytics

What does it do?

Crashlytics helps you to collect analytics and details about crashes and errors that occur in your app. It does this through three aspects:

  • Logs: Log events in your app to be sent with the crash report for context if your app crashes.
  • Crash reports: Every crash is automatically turned into a crash report and sent when the application next opens.
  • Stack traces: Even when an error is caught and your app recovers, the Dart stack trace can still be sent.

Installation

1. Add dependency

pubspec.yaml
dependencies:
flutter:
sdk: flutter
firebase_core: "^0.5.0+1"
firebase_crashlytics: "^0.2.1+1"

2. Download dependency

$ flutter pub get

3. Platform integration

If you are migrating from a previous version of Crashlytics that used Fabric, please follow these guides and remove any legacy Fabric integration steps from your project:

a. Android

  1. Add the following classpaths to your android/build.gradle file.
android/build.gradle
dependencies {
// ... other dependencies
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
}
  1. Apply the following to your android/app/build.gradle file.
android/app/build.gradle
// ... other imports
apply plugin: 'com.google.firebase.crashlytics'
android {
// ... your android config
}

b. iOS

  1. From Xcode select Runner from the project navigation.
  2. Select the Build Phases tab, then click + > New Run Script Phase.
  3. Add ${PODS_ROOT}/FirebaseCrashlytics/run to the Type a script... text box.
  4. Optionally you can also provide your app's built Info.plist location to the build phase's Input Files field: For example: $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

4. Rebuild your app

Once complete, rebuild your Flutter application:

$ flutter run

Next steps

Once installed, you're ready to start using Firebase Crashlytics in your Flutter Project. View the Usage documentation to get started.