Developers who publish their applications on the Android Market need to pay careful attention to how well their applications work for users, or suffer from negative ratings. One very helpful way to track down problems with your published applications is to encourage users to file crash feedback and then review the feedback and fix the problems in a prompt fashion. Today we talk about how Android Market Crash logs are generated and what they mean.
Crash logs are a valuable resource for developers. They can be used to track down bugs, issues with specific devices, and other issues that make users unhappy with application performance. However, they are only available for published applications.
How is Crash Data Collected from the User?
When your application shuts down due to a crash, the user is shown a prompt that states that the application has stopped unexpectedly. The user has two choices: OK or Report, as shown:.
If the user hits OK, the application simply shuts down. However, if they choose to report the issue, a simple form comes up so the user can describe the event and send it in to the crash logs for the developer to review, as shown:
As a Developer, where can I find the Crash Logs?
The crash logs are accessed through the developer's Android Market account—the same place you upload new applications and publish them. Once an application is published, users are free to report crashes they experience. These reports show up almost immediately for the developer to review. You can determine if you have any crash reports from the main Android Market listing. If your application has errors, they will be displayed as part of the listing. Here is a screenshot that shows a sample listing with crash log entries to review.
Note: Crash reports are only available to currently published applications. If you hit unpublish, your crash reports become unavailable at this time. Thus, if you're having a critical problem, copy the crash reports first, then unpublish to prevent more people from experience the problem.
Exploring the Application Error Report Overview
If you click on the error report for a specific application, you will see some general statistics about your application errors, such as freezes (shut downs due to lack of response) and crashes. As you can see from the screenshot below, this simple application has one new crash to be reviewed. You can also see statistics such as how many freezes and crashes your application is having in the field per week.
Reviewing the Specific Error
Click on the specific error to see more details about what happened. For this tutorial, we manufactured a specific error. That is, the application launches and immediately throws the following exception:
throw new Error("Whoops");
If you click on the specific error, you will see what method the error occurred in, how many times it has been reported, and the weekly numbers for that particular error, as shown here:
Drilling down to the Stack Trace
If you continue to drill down on the error, you will find more detailed information about the crash. For example, that an Error exception was thrown in the source method called forceError(). This is, indeed, what occurred. You can also see the stack trace (in this un-obfuscated version of the app). Note the java.lang.Error: Whoops on the first line, as shown in this screenshot:
Note: If you obfuscate your code using ProGuard, you will need to use the retrace tool to read these stack traces. This tool is available as part of the Android SDK tools for download.
From this screen you can also mark the error as old (meaning you have reviewed it). You can also toggle to show the user messages (form data) associated with these errors.
Toggling to the User Messages
If you click the Show user messages link on the stack trace screen, you will be able to see the descriptions of the errors sent in by users, as shown in the screenshot below. In some cases, this might be helpful information, while in others, they may just yell at you for publishing apps with bugs. :P
From this screen you can also mark the error as old (meaning you have reviewed it). You can also toggle back to the stack traces by clicking on the Show stack traces link.
Android Market crash reports provide developers with useful information about their applications. Crash reports are not generated automatically. The user must choose to report the error. The application must be installed through the Android Market for this feature to work properly. Crash reports contain error information including stack traces as well as user-generated descriptions of what occurred. Review your crash reports frequently to stay ahead of any problems your application is having in the field and update your application in a timely manner-before your ratings tank!
About the Authors
Mobile developers Lauren Darcey and Shane Conder have coauthored several books on Android development: an in-depth programming book entitled Android Wireless Application Development and Sams Teach Yourself Android Application Development in 24 Hours. When not writing, they spend their time developing mobile software at their company and providing consulting services. They can be reached at via email to firstname.lastname@example.org, via their blog at androidbook.blogspot.com, and on Twitter @androidwireless.
Need More Help Writing Android Apps? Check out our Latest Books and Resources!
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post