The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Crash Reporting Using ACRA

When you wrote your app, you intended for it to work.

Alas, the road to a very warm place is paved with good intentions.

Hence, it is fairly likely that your app will crash in the hands of your users. In order to be able to fix the underlying problems, you need to learn about the crashes and the state of the app at the time of the crash.

There are any number of solutions to this problem. This chapter will outline a few of them and focus on one open source solution: Application Crash Reports for Android, better known as ACRA.

Prerequisites

Understanding this chapter requires that you have read the core chapters and understand how Android apps are set up and operate. Having read the chapter on notifications is also a good idea, though not absolutely essential.

What Happens When Things Go “Boom”?

In development, when your app crashes, you get a little dialog box indicating that the app crashed, and you get your Java stack trace in Logcat.

In production, little of that does you any good. In particular, you have no way of seeing Logcat from end user devices. Instead, you need to have some means of capturing that stack trace, along with perhaps additional data, and collect it somewhere.

App distribution channels may offer this as part of their feature set. The Play Store, in particular, offers its own crash reporting, where crashes “in the field” get reported to you by means of your Developer Console on the Web. However:

Various other services, from Crashlytics to Crittercism, offer their own crash reporting as part of a larger suite of features. However, once again, you may not have control over what data is collected, and you certainly have no control over who all gets the data.

For the privacy-minded app developer, you want something along these lines, but where you can control to a fine degree of detail what gets collected and where the data is sent solely to you, not to some third party.

And that’s where ACRA comes in.

Introducing ACRA

The preview of this section was last seen in the Bermuda Triangle.

Where ACRA Reports Crashes

The preview of this section is in an invisible, microscopic font.

ACRA Integration Basics

The preview of this section is [REDACTED].

What the User Sees

The preview of this section is sleeping in.

What You See

The preview of this section apparently resembled a Pokémon.

Customizing Where Reports Go

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.

Adding Additional Data

The preview of this section was stepped on by Godzilla.

Removing Data

The preview of this section is en route to Mars.

End-User Configuration

The preview of this section is in the process of being translated from its native Klingon.

ACRA and Processes

The preview of this section is en route to Mars.