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.

Specifically, this chapter covers ACRA 5.1.1. If you used ACRA previously, the configuration API has changed a fair bit, particularly in terms of the annotations that you can use.

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 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 left for Hollywood to appear in a reality TV show.

Where ACRA Reports Crashes

The preview of this section was lost due to a rupture in the space-time continuum.

ACRA Integration Basics

The preview of this section took that left turn at Albuquerque.

What the User Sees

The preview of this section may contain nuts.

What You See

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

ACRA and Processes

The preview of this section is unavailable right now, but if you leave your name and number at the sound of the tone, it might get back to you (BEEEEEEEEEEEEP!).