Monday, April 1, 2013

Adding Crash Reports

During the development phase of Android application you can use: Log messages, toast and debugger in order to debug your application.
You can use Android emulator or real device connected to your development environment in order to test your application and get all log messages and unexpected behavioral. 
While testing your application on real devices and especially after successful releasing the application it is very useful to get your application crash report. 
If your application crashes any where in the world it is better to know about it in order to fix it.
A free tool that enable the developer get his application crash report is ACRA
ACRA is very simple library that you add to your application.Crash reports are sent Google drive document and get email notification (please follow the setup steps).
The information receive from ACRA includes:

  • Application name and version
  • Phone brand and model
  • Android version and build number
  • Memory information
  • Device initial configuration
  • Crash configuration
  • Stack trace

More information can be add to the crash report for example logcat output, application log file etc...

Include ACRA in your application in four simple steps
1. Download ACRA library and include it in your application build path.
2. Add application class to the manifest and 
add internet permission. 

1:  <manifest ...>  
2:   <application ... android:name="MyApplication">  
3:    ...  
4:   </application>  
5:   <uses-permission android:name="android.permission.INTERNET">  
6:   </uses-permission>  
7:  </manifest>  

3. Generate Google Doc key (instructions from ACRA). Google drive document can be set to send  email notification on every change in the document. Remark Google has made changes in their Google forms for new option please see my post.

4. Implement application class
1:  import org.acra.*;  
2:  import org.acra.annotation.*;  
//Generate Google Doc code
3:  @ReportsCrashes(formKey = "dGVacG0ydVHnaNHjRjVTUTEtb3FPWGc6MQ")  
4:  public class MyApplication extends Application {  
5:   @Override  
6:   public void onCreate() {  
7:    // The following line triggers the initialization of ACRA  
8:    ACRA.init(this);  
9:    super.onCreate();  
10:   }  
11:  }       

ACRA report sender can be extend/change according to your application requirements by implementing you own report sender, example implementation for saving the crash report to file located on the SD card can be found here.  

11 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. "Using Google Drive Forms as the ACRA reporting endpoint will not be supported anymore with the next releases"

    http://stackoverflow.com/questions/15781986/acra-integration-and-google-drive

    ReplyDelete
    Replies
    1. Your are right I had old document with key that still work, you can easy switch to bugsense and still use ACRA. I am working on alternate solution and will update when I have solution.

      Delete
  3. Thanks for appreciating. Really means and inspires a lot to hear from you guys.I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..Believe me, This is very helpful for me
    Digital Marketing Company in chennai
    Digital Marketing Company in India

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I am happy for sharing on this blog its awesome blog I really impressed. thanks for sharing.

    Learn Best Tableau Training in Bangalore from Experts. Softgen Infotech offers the Best Tableau Training in Bangalore.100% Placement Assistance, Live Classroom Sessions, Only Technical Profiles, 24x7 Lab Infrastructure Support.

    ReplyDelete
  6. Interesting information and attractive.This blog is really rocking... Yes, the post is very interesting and I really like it.I never seen articles like this. I meant it's so knowledgeable, informative, and good looking site. I appreciate your hard work. Good job.
    DevOps Training in Chennai

    DevOps Course in Chennai

    ReplyDelete
  7. Very Informative blog thank you for sharing. Keep sharing.

    Best software training institute in Chennai. Make your career development the best by learning software courses.

    msbi training in Chennai
    cloud computing courses in chennai
    uipath training in chennai

    ReplyDelete