Crashlytics — Google Firebase Crash Reporting for your Android App.

!Beautiful side of crashes and bugs.

Krzysztof Marczewski
AndroidPub

--

TL;DR

We cannot monitor app behavior on every device and environment, so our apps may produce unknown bugs and crashes on some of them. If you want to get reports and info about those errors Firebase Crashlytics is a tool you should check out.

Not working? On MY device it works.

I admit it - there’s nothing beautiful when your app crashes. Especially when it happens on other people devices. Even if you’re sure that your app works like a charm, there is still chance that on some devices will not.

When you realize it, you may wonder how to get feedback from users. What’s going on the other side? On their devices. What’s causing this avalanche of uninstalls? Because the fact that someone says “It worked for me” doesn’t mean that it will work everywhere.

Android devices are as diverse as people. They respond differently. If your app has bugs, some devices may not crash, and some will for sure. And you know what happens to your app when it’s not working correctly.

And here’s the moment when you need some help. From the outside. Especially if your app is released and your Google Developer Console reports are showing sad info about the number of uninstalls.

Crashlytics

So you said, that you need some tool for crash analyses and bug reports? Something easy to set up, clearly presented and even free (for small projects)?— Crashlytics could be an answer.

This solution isn’t anything new. So why I dig it up? Because the best part is that Fabric (maker of Crashlytics) joins Google Firebase in 2017 and Crashlytics (beta) becomes part of it.

If you thought that you don’t need Firebase inside your app (maybe it’s still true), here’s a good reason to give it a chance.

Set-up for Android

Dead easy set up:

After creating Firebase account and adding firebase to android project

which is adding the personalized .json file to android project structure manually or by using Firebase Assistant inside Android Studio

it requires only to add listed dependencies to both of build.gradle files and here we go! Just open Crashlytics inside your firebase console.

If everything goes fine after your app crashes you may get an email notification with the report.

Don’t wait for crash — force it by yourself

How to test Crashlytics when you don’t have an idea how to crash your app (yet)?They come with their own SOLUTION ( ͡° ͜ʖ ͡°).

Just add this code to your project and hit a new button.

Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});
addContentView(crashButton,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));

Reports

Voila, you’ve just crash your app — and if you set up everything correctly you’ve got new mail.

Sample mail notification

If you want to know more details about the bug, go to firebase console where you could check statistics about the device where bug come true and most important — exact place of occurrence.

Crashlytics console and bug details

Conclusion

Crashlytics is another Firebase pros, but if you will use only this feature it may come with the cost of lots dependencies inside your project.

I hope you like this post and found this useful!

--

--

Krzysztof Marczewski
AndroidPub

📱 Mobile dev focused on how to develop great code and yourself as a coder. 💡 Providing continuous self-development ideas on: http://bio.link/selfformat