How to use ACRA with HockeyApp

Application Crash Report for Android (ACRA) enables Android apps to automatically post crash reports to various targets, e.g. a GoogleDoc form, an email server, or a remote service like HockeyApp. If you prefer to use ACRA instead of our HockeySDK for Android, here's a short tutorial:

Step1: Integrate ACRA:

Eclipse:

  1. Download ACRA.

  2. Extract the .zip file and add build/acra-4.4.0.jar into the libs folder of your project.

Android Studio:

  1. Copy “ compile ‘ch.acra:acra:4.8.5’ ” to dependencies of build.gradle

  2. Copy “ android {useLibrary ‘org.apache.http.legacy’} “ to root directory of build.gradle (If you are using Android SDK 6.0+)

Step2: Integrate HockeyApp:

  1. If your app already contains an Application subclass, add ACRA to this class. Otherwise create a new subclass in your package root. The ACRA configuration for HockeyApp is shown here.
    i. If you are using ACRA 4.8.0 + . The ACRA configuration is shown here.

  2. Replace APP_ID with your App ID on HockeyApp.

  3. Open your AndroidManifest.xml and add an android:name attribute to your application element like this:

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:name="MyApplication">
    
  4. The AndroidManifest.xml should also include the following line:

    <uses-permission android:name="android.permission.INTERNET" />
    
  5. Add a new class HockeySender to your project and copy the code from here to the class file. Adjust the package name at the top to your namespace.
    i. If you are using ACRA 4.8.0 +, you also need to add a new class HockeySenderFactory to your project and copy the code from here to the class file.

  6. Build and run your project.

The sender sets the INSTALLATION_ID for the field "User" on HockeyApp, USER_EMAIL for the field "Contact", and USER_COMMENT as the description. USER_EMAIL and USER_COMMENT only contain values if you configured ACRA as described here. Other ACRA options should work as well. Custom field can't be set via ACRA, but it should be easy to modify the HockeySender class to add your values.

If you want to use ACRA for crash reporting and our HockeySDK for beta distribution in the same app, you can do so. Just make sure to not class the method "register" of the class "net.hockeyapp.android.CrashManager".