My brain-dump of random code/configuration.

10 Jun 2014

Gathering Crash Reports and User Feedback for Your Android App

tl;dr: How-to use ACRA and a PHP-script for getting fairly pretty crash-reports and user-feedback via email (without ugly Android email-Intents)


I’m the developer of OpenTraining, an open source Android app for fitness training. I recently looked for a possibility to add a simple feedback system to my app. There’s an open source framework for crash reports named ACRA that I decided to use for both crash reports and user feedback.

The Google Play Store offers a crash report system as well, but if you deploy your app on multiple app stores you might want a central instance for collecting crash reports. For user feedback many apps simply open an email-Intent but I don’t think this offers a good user experience.

This is how the user feedback dialog and the generated mail look like:

Android feedback dialog and feedback mail


  • simple
  • self-hosted
  • good workflow for smaller projects
  • only PHP required


  • does not scale (e.g. if you have 50.000+ users)

If your project is pretty large you should consider another ACRA-backend. I tried some of them, but as long as I get < 20 emails per week I’ll use the PHP backend.

This How-to is based on ACRA and ACRA-mailer.


The most important changes I had to apply to my project for adding the feedback-feature can be seen in this commit on GitHub (but there have been some more commits concerning ACRA).

1. Add ACRA to your project

  • Open your Eclipse project
  • Add the file acra-4.X.Y.jar to the libs folder
  • Right-click on the jar file -> add to build path

If you have any problems with this step have a look at the ACRA documentation. There’s also a description for Gradle integration.

2. Use the ACRA library

Create a new class that extends Application:

import org.acra.*;
import org.acra.annotation.*;

import android.app.Application;

    formKey = "" // This is required for backward compatibility but not used

public class YourApplication extends Application{

     public void onCreate() {

         // The following line triggers the initialization of ACRA
         ACRA.getErrorReporter().setReportSender(new ACRACrashReportMailer()); // default crash report sender


Open the android manifest editor (AndroidManifest.xml)

  • In the Application tab, click on the Browse button next to the Name field
  • Select your newly created Application class

Make sure that your application requests the permission ‘android.permission.INTERNET’.

3. Add ReportSender

I use 2 different implementations of ReportSender:

The crash reporter sends nearly all data that’s available, the feedback reporter sends the user message, the date and the app version. Add both to your project.

Remember to change the ‘BASE_URL’. Use HTTPS if your server supports it (mine doesn’t).

4. Add PHP scripts

There are 2 PHP scripts as well:

You will also need the mail template. Change the destination email and add the files to the webspace/server of your choice (e.g. uberspace). If you want you can change the “shared_secret”, but remember to do this in the Java class as well.

5. Test receiving feedback

Now you should have a try and test sending feedback to yourself:

ACRA.getErrorReporter().setReportSender(new ACRAFeedbackMailer());
ACRA.getErrorReporter().putCustomData("User message", "Some Text here");
ACRA.getErrorReporter().handleSilentException(new NullPointerException("Test"));

If this works you need a suitable spot for your user feedback. In most cases a dialog should be fine.

Consider to write your own class(es) that extend(s) Exception. Your PHP script could do further processing with this information.

Ideas for further improvements

Improve the email formatting

As you have a server-side script it is very easy to change the formatting of the emails. Highlighting the user comments or the type of exception may be a good first step.

Usage for larger projects

With the use of two different implementations of ReportSender it is also possible to use email only for sending feedback and send crash reports to another backend that is better suited for bug tracking. For larger projects this approach is recommended.

by Christian Skubich

eMail: christian@skubware.de

Twitter: @chaosbastler

comments powered by Disqus