Set up Crashlytics: Android

Gaurav Rajput
2 min readDec 7, 2020

--

Let’s see how we can enable live crash reporting on firebase. It’s very straightforward and can be done in a few minutes. First of all, you have to integrate firebase. It can be seen here:

For this, we have to enable Crashlytics for our app.

As you are done with the firebase setup, let’s see how we can enable Crashlytics for our app. Go to Crashlytics under the Quality section (left-hand nav panel) and click on that.

After clicking on crashlytics, you will see the above screen. Now click on Enable Crashlytics . You will be moved to here.

Now got to your project-level build.gradle and add this (version can be changed here I am using 2.4.1)

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'

In your app-level build.gradle add this

// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'

Now to initialize the crashlytics add the below lines in your app-level build.gradle

// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:26.1.1')


// Declare the dependencies for the Crashlytics and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'

Now Sync the gradle changes

Now force a crash in your application; for example, you can put the below line in your code.

Log.d("TEST", "${1/0}");

Now, as soon as a crash happens on your device, it will show this crash on the crashlytics section like below:

Great! Isn’t it. It will be immediately reflected on crashlytics. Congratulation, you have successfully enabled Crashlytics, and now you can see every crash on firebase. It is very beneficial to make your product crash-free.

--

--