Crash Reporting with ACRA

suggest change

Step 1: Add the dependency of latest ACRA AAR to your application gradle(build.gradle).

Step 2: In your application class(the class which extends Application; if not create it) Add a @ReportsCrashes annotation and override the attachBaseContext() method.

Step 3: Initialize the ACRA class in your application class

@ReportsCrashes(
    formUri = "Your choice of backend",
    reportType = REPORT_TYPES(JSON/FORM),
    httpMethod = HTTP_METHOD(POST/PUT),
    formUriBasicAuthLogin = "AUTH_USERNAME",
    formUriBasicAuthPassword = "AUTH_PASSWORD,
    customReportContent = {
            ReportField.USER_APP_START_DATE,
            ReportField.USER_CRASH_DATE,
            ReportField.APP_VERSION_CODE,
            ReportField.APP_VERSION_NAME,
            ReportField.ANDROID_VERSION,
            ReportField.DEVICE_ID,
            ReportField.BUILD,
            ReportField.BRAND,
            ReportField.DEVICE_FEATURES,
            ReportField.PACKAGE_NAME,
            ReportField.REPORT_ID,
            ReportField.STACK_TRACE,
    },
    mode = NOTIFICATION_TYPE(TOAST,DIALOG,NOTIFICATION)
    resToastText = R.string.crash_text_toast)

    public class MyApplication extends Application {
     @Override
            protected void attachBaseContext(Context base) {
                super.attachBaseContext(base);
                // Initialization of ACRA
                ACRA.init(this);
            }
    }

Where AUTH_USERNAME and AUTH_PASSWORD are the credentials of your desired backends.

Step 4: Define the Application class in AndroidManifest.xml

<application
       android:name=".MyApplication">
       <service></service>
       <activity></activity>
       <receiver></receiver>
</application>

Step 5: Make sure you have internet permission to receive the report from crashed application

<uses-permission android:name="android.permission.INTERNET"/>

In case if you want to send the silent report to the backend then just use the below method to achieve it.

ACRA.getErrorReporter().handleSilentException(e);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Crash Reporting Tools:
* Crash Reporting with ACRA

Table Of Contents
2 Gradle
5 Intent
17 Service
19 WebView
31 SQLite
35 Glide
37 Dialog
38 ACRA
44 Handler
53 Toast
63 Menu
65 Picasso
70 Volley
71 Widgets
78 Realm
90 Spinner
95 OkHttp
100 Crash Reporting Tools
108 TextView
109 ListView
111 Loader
118 Xposed
119 Security
121 ImageView
123 Doze Mode
130 Drawables
131 Colors
134 Fresco
139 AdMob
145 Keyboard
146 Button
150 EditText
155 Vk SDK
163 ExoPlayer
169 XMPP
175 OpenCV
177 Threads
184 ORMLite
186 TabLayout
190 LruCache
192 Zip files
194 Fastlane
199 FileIO
202 Moshi
210 VideoView
216 Paint
218 ProGuard
226 CleverTap
228 ADB shell
229 Ping ICMP
230 AIDL
234 Context
240 JCodec
242 Okio
249 FuseView
254 Looper
261 Fastjson
263 Jackson
267 Smartcard