Installation

To send errors to Rollbar from your Java application, you should use our rollbar-java package.

compile('com.rollbar:rollbar-java:1.0.0')

rollbar-android

For an Android app, we have some more specific pieces which allow you to capture more information about the Android environment automatically than what you would have to do with rollbar-java directly.

Set your access token in your AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <application ...>
        ...
        <meta-data android:name="com.rollbar.android.ACCESS_TOKEN"
        android:value="{{ client_access_token }}" />
    </application>
</manifest>

Then initialize Rollbar in your MainActivity:

import com.rollbar.android.Rollbar

public class MainActivity extends AppCompatActivity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Rollbar.init(this);
    ...
  }
}

You can then make direct calls to Rollbar via the managed instance:

void clickAction() {
  Rollbar.instance().log("Some button was clicked");
}

All uncaught exceptions which cause a crash will also be logged by Rollbar, but will not be sent until the next time the app runs.

You can see a rollbar-android example on GitHub.

Configuration

All configuration is done via the Config object in rollbar-java. You can see the interface here.