How to add Firebase Crash Reporting to your app
suggest changeIn order to add Firebase Crash Reporting to your app, perform the following steps:
- Create an app on the Firebase Console here.
- Copy the
google-services.json
file from your project into your inapp/
directory. - Add the following rules to your root-level build.gradle file in order to include the
google-services
plugin:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:3.0.0'
}
}
- In your module Gradle file, add the
apply plugin
line at the bottom of the file to enable the Gradle plugin:
apply plugin: 'com.google.gms.google-services'
- Add the dependency for Crash Reporting to your app-level build.gradle file:
compile 'com.google.firebase:firebase-crash:10.2.1'
- You can then fire a custom exception from your application by using the following line:
FirebaseCrash.report(new Exception("Non Fatal Error logging"));
All your fatal exceptions will be reported to your Firebase Console.
- If you want to add custom logs to a console, you can use the following code:
FirebaseCrash.log("Level 2 completed.");
For more information, please visit:
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents