How to setup Rollbar (real time error reporting/tracking) on any Android app


Setup


Step 1

Add this to your build.gradle(module: app)

Step 2

Download this to your project’s libs folder

Local mirror  |  Vendor mirror

Step 3

Add this to your custom Application subclass’ onCreate()

Step 4

Make sure your AndroidManifest.xml contains the android.permission.INTERNET permission.


Usage


  • Rollbar.setPersonData(String id, String username, String email)Sets the properties of the current user (called a “person” in Rollbar parlance) to be sent along with every report.Default: all  null
  • Rollbar.setReportUncaughtExceptions(boolean report)Sets whether or not to report uncaught exceptions to Rollbar.Default:  true
  • Rollbar.setIncludeLogcat(boolean includeLogcat)Sets whether or not to include logcat output in reports to Rollbar.Note: For devices with API level 15 and lower, you will need to include the  android.permission.READ_LOGS permission in your app’s  AndroidManifest.xml for logcat collection to work.

    Default:  false

  • Rollbar.setDefaultCaughtExceptionLevel(String level)Sets the level caught exceptions are reported as by default.Default:  "warning"

    The available error levels are: “debug”, “info”, “warning”, “error” and “critical”.

  • Rollbar.setUncaughtExceptionLevel(String level)Sets the level uncaught exceptions are reported as.Default:  "error"
  • Rollbar.setSendOnUncaughtException(boolean send)If true, uncaught exceptions will immediately be sent to Rollbar, blocking the process shutdown sequence. If false, the exception will just be saved to disk so that it can be sent next time the process starts.Default:  false
  • Rollbar.setEndpoint(String endpoint)If you are using Rollbar Enterprise, call  setEndpoint to route events to your Rollbar instance. (Most users will not need to do this.)Default:  "https://api.rollbar.com/api/1/items/"
  • Rollbar.setItemScheduleDelay(int delay)Sets the delay between retries of sending failed items, in seconds.Default:  30

 

Here’s a sample of all of it put together (settings I used for testing):

 

Was this blog post helpful for you?

Support my blog and donate!

My blog is open to the public and will always be freely available. With your donation, we can help others learn, together.