Saturday, October 16, 2010

How to improve your application - the ultimate crash reporter : ACRA

I've already introduce some way to create a crash reporter ( here and here ).
But now, I've found what I think is the ultimate crash reporter for Android !

Remember : 
My solution was, when a crash occured, to collect the callstack, some potentially interesting other var, some custom data for the application, and to form a email with all these informations, give them to gmail, so the user could send this email with some data on the current crash !
That was a nice first step, but a lot of people just didn't wanted to send the mail, fearing that it would be used for spams.
A better solution would have been to have my own web server with a special page to receive and treat bug reports, but I didn't have time to make the server part, so I was still using my mail solution !

Here's come Nivek !
Then, 6 month ago, on a french Android developer forum ( FrAndroid ), someone asked how people were dealing with crashes. So I presented my solution. Some people found it interesting, and then Nivek has THE idea ! Nivek ( whose real name is Kevin Gaudin and who is the creator of Email Album ) is a smart guy, that was quite active on the forum, and whose interventions are always interesting ( and it's quite rare on developers forums... ).
He proposed to send the crash report to  a google doc form !
Then he took my code, added this possibility, and make a nice open Source project from it.
ACRA was born !

The advantages of ACRA are :
* You don't have to develop your own server side solution, it's all done by google. You don't even need a web server. A google login is enough !
* All crash reports are sent. Nivek made it modular so you can choose how you inform the user that a crash was send ( no feedback, toast feedback, feedback as a notification )
* it's soooo easy to use !
* It's working with every Android version
* You still can add your own custom informations
* You can use it to send information even when there is no crash ( for instance if your code is in a strange state, but you manage to catch the problem, and put it back in a stable state. You may still be interested by what bring this strange state in the first place ).
* You can receive a mail each time the google doc has changed ( so each time a new bug arrived ), or in a daily digest form (that's what I'm using ).
* Lastly, and this is something I didn't have time to investigate, but I'm sure is _really_ powerful, you can use all the power of Google doc to use the information and present it in any useful way you want.

I really think the last point is very important !
If you have your own web server solution, you can get the crash data and insert them in a database. But then you still need some tools ( ie some developments ) to interpret the data.
Here, Google doc can really help you. For instance, creating graphics is a easy task.
As I said, I didn't take time to investigate, but I think it would be really easy to have :
* A graph with the number of daily bugs
* A graph with the number of daily bugs for each different versions
* A top of the most seens bug in the last X days.
* A link between the crashes and the phone model

If you find some interesting way to use google Doc to present the crash information, please inform the community !!

Are there any cons ?
Not really.
-You obvioulsy need the internet permission to use it.
-With the new license server introduced by google to fight agains piracy, it is highly recommanded to obfuscate your code. Obfuscated call stacks will be hard to understand in the google doc !
- it won't catch Application Not Responding issues.

And that's all I can see...
To be honest, if you can leave with the internet permission, I just see no reason not to use it.

Here is once again the link to the google code project.
Make a better code, use ACRA !!!


Mike said...

Why didn't you use an existing crash server and just provide a new client for it? That'd probably be easier.

For example, Hoptoad.

Kevin Gaudin said...

@Mike> I did not know Hoptoad or any other similar service... But basically, a Google spreadsheet is free, relyable and easy to use.

@AndroidBlogger> thanks ;-) You're still welcome for any new contribution on the project... and this is true for any other dev with ideas !!! :-)

Another interesting point about ACRA: you don't have to publish your app on the marketplace to receive the reports, so it's great for enterprise apps or to track defects from device that don't come with Google's marketplace installed.

Kevin Gaudin said...

A new version of ACRA is available (v3) and ready to be tested by developers.

ACRA's configuration is now based on an annotation instead of extending an ACRA-specific Application subclass, which was preventing devs from using ACRA with other libs like GreenDroid, Droid-Fu or RoboGuice. ACRA's conf is now much cleaner and even easier.

In addition, reports now contain Configuration details (from app start + when crash occurs) to help diagnose issues due to specific hardware, languages, or configuration changes (orientation, physical keyboard...), screen metrics details (resolution, density...) and a user local date/time of crash.

Please use it and report issues in the issue tracker if you find any.

May it help you find all these tricky bugs!

Anonymous said...

this is so cool, thanks for sharing and for your previous posts on reporting exceptions!

Kevin Gaudin said...

The power of using Google spreadsheets is emerging:

Sample here:

Eduardo Teixeira said...

Congratulations, it's simple and functional.

Jon said...

You could also use as your backend for ACRA if your want error analytics and graphs. It's free (ps: I am one of the founders).