Bringing Firebase Crashlytics into Android Studio with Electric Ele’s App Quality Insights Tool Window

Priya Sindkar
Novumlogic
Published in
6 min readJan 31, 2023

Bringing Firebase Crashlytics into Android Studio

Android Studio Electric Eel splash screen

Android Studio Electric Eel, v2022.1.1 brings with it a lot of cool new features amongst which is The new App Quality Insights tool window.

App Quality Insights tool window allows you to view your app’s crashes in Android Studio itself, without having to open Firebase Crashlytics in a browser to view your crashes and their stats.

App Quality Insights Tool Window

Summary of features available with the App Quality Insights

  1. View crash stack traces with logcat like links to jump to the line of code causing a crash
  2. View number of users affected by each crash event
  3. View various stats about each crash like no of devices affected, android versions affected, most affected device, etc.
  4. Filter results based on date range, app version, severity of a crash
  5. Direct link to open Firebase Crashlytics in browser to view more details
  6. Crash indications in the gutter besides the line of code where crashes have occurred

Steps to integrate Firebase Crashlytics in Android Studio

Step 1. Connect your android app with Firebase

This is the most basic step one follows to connect an android app with Firebase. If you are a regular Android and Firebase developer, you already are well aware of this step. If so, skip to Step-3.

In order to integrate Firebase Crashlytics in your app you first need to connect your app with Firebase on the Firebase Console. Briefly, the steps to do so are as follows: Go to Firebase Console -> Create a new Project -> Connect Firebase with your android app within the new project -> Add the google-services.json file to the android app’s root folder.

Step 2. Add Crashlytics dependencies in your project

Again, a very common step to add the Crashlytics SDK into your android app project.

Add the following dependencies in your project-level build.gradle file-

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
...
classpath 'com.android.tools.build:gradle:7.2.0'

classpath 'com.google.gms:google-services:4.3.15'

classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
}
}

Add the following in your app-level build.gradle file-

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}

...

dependencies {
...
implementation platform('com.google.firebase:firebase-bom:31.2.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
}

Step 3. Login with your Firebase account in Android Studio

For projects already integrated with Crashlytics and login already done in Android Studio, opening the App Quality Insights tool window will start showing the crash analytics immediately.

In order to access the crash logs, we need to login with that email id which has access to the Firebase console for the said app.

To login,

Click on the “get started with Firebase” link shown in the yet-to-be-integrated App Quality Insights tool window (View->Tool Windows-> App Quality Insights).

Login to Firebase from Android Studio

Or,

Click on the profile image on the top-right corner of Android studio. There, you can add your account and get started.

Login to Google Account From Android Studio

Avoiding the PERMISSION_DENIED error

If like me, you too work on your office and personal projects from the same Android Studio, you may come across this error while switching between 2 projects-

PERMISSION_DENIED: The caller does not have permission

PERMISSION_DENIED error when trying to access with wrong email Id

And if you too, like me are somehow too tired while trying out this tool window, you might not get to the simple solution to this error quickly.

So here is the solution to the above error which I got to after wasting two precious hours wondering what could possibly have gone wrong and re-checking all dependencies and Gradle version multiple times-

Click on the profile image on top-right corner of Android Studio select the account with access to this Firebase project!

Multiple Accounts to select from

While logging, you will be asked to allow Android Studio to access some data. We must click on Allow in order to integrate our App Quality Insight window.

Allow Firebase to proceed further

Step 4. Start getting the most of the tool!

After completing the above step, go to Android Studio and you will now be able to access your crash logs in the App Insights window.

The App Quality Insights tool Window

Most of the features from the tool can be found very well versed in this official blog post by Android Developers.

Exploring a little further, here are some other features that this tool has to provide-

  1. Refresh- Use the refresh button to quickly refresh the crash logs. (This refresh is faster then when we refresh Crashlytics in the browser)
Refresh Logs

2. Once a crash is closed from the Firebase console, the gutter indications and the crash logs are wiped out. In order to see that particular crash log again in app insights window, we need to reopen the bug from the console.

3. Arrange issue list panel columns as per convenience. For example- We may want to prioritise all the events based on no of times that issue is faced or number of users affected by the event and might not want to look at the actual crash.

4. Direct link to open Crashlytics in browser for detailed analysis, when we need to dig deep into the crash and view other data like region, user engagement, user activity, etc.

Direct link to Crashlytics in browser

5. Create a Java Exception breakpoint from the stacktrace

Create Java Exception Breakpoint

This feature is super helpful when you may not be able to reproduce this crash and would like to put a breakpoint for this exception to get more clarity on the bug.

Conclusion

Having App Quality Insight tool window inside our app really helped us to quickly work on the crashes, new and old. We are already using the tool to address all crashes and taking one step towards making a crash-free application. Analysing the app crashes have also become a speedy process for us which reduces considerable time that was earlier lost in switching between Android Studio and the browser. Refresh time in Android Studio is also less comparatively as only limited, required information is shown in Studio.

--

--

Priya Sindkar
Novumlogic

Sr. Android Developer 💚 | Believer in neat code and clean architecture | Loves to read | A coder through and through 👩🏻‍💻