Wednesday, April 11, 2012

Acra App Crash Reporting


There is a great tool called Application Crash Report for Android (ACRA) that allows Android apps to automatically and completely silently upload force close crashes to a GoogleDoc form.  More information is at http://code.google.com/p/acra/wiki/BasicSetup  This open source projects provides a jar that will capture a force close and post that information to a Google documents spreadsheet.  This spreadsheet contains a bunch of information including Android SDK version, time of crash and most importantly the trace from the Exception. I've used this now on 5 or 6 projects and it is invaluable.

Integrating with your code takes about an hour, maybe two including setting up the Google document form. It's really that easy.

There are two important steps:
1. Create a Google document form following the information in basic setup and make sure that it's public.
2. Add two lines of code to a custom application class and put the jar into the project







@ReportsCrashes(formKey = "dEx2QVB0aUNrSzdBV1JaOS13NW1Fd0E6MQ") 

 public class MyApplication extends Application { 

      

      @Override 

      public final void onCreate() { 

     // The following line triggers the initialization of ACRA 

     ACRA.init(this); 

           super.onCreate(); 

         

      } 

 }  



I want to stress that I personally beleive that Acra is for testing only. This tool shows how easy it is for apps to report very detailed information about usage and it happens all the time.  I personally don't like it without user knowledge.  I don't recommend to my clients that they use this in production for the sole reason that it is reporting data about users without their knowledge. The report does not contain anything very sensitive about an individual user, however I personally feel that this type of reporting/tracking without explicit acceptance of terms and conditions is not appropriate.  It is easy to turn on and off though and ACRA does provide an opt-in mechanism when a crash occurs. Using the optin and/or making it clear in terms and conditions would make the use in production more acceptable.