Manual Setup

Learn how to set up the SDK manually.

If you can't (or prefer not to) run the automatic setup, you can follow the instructions below to configure your application manually.

The easiest way to get started is to install the Sentry Android Gradle plugin to your app module's build.gradle file.

app/build.gradle
Copied
plugins {
  id "com.android.application"
  id "io.sentry.android.gradle" version "4.11.0"
}

Version 4.11.0 of the plugin will automatically add the Sentry Android SDK (version 7.15.0) to your app.

Configuration is done via the application AndroidManifest.xml. Here's an example config which should get you started:

AndroidManifest.xml
Copied
<application>
  <!-- Required: set your sentry.io project identifier (DSN) -->
  <meta-data
    android:name="io.sentry.dsn"
    android:value="https://examplePublicKey@o0.ingest.sentry.io/0"
  />

  <!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
  <meta-data
    android:name="io.sentry.traces.user-interaction.enable"
    android:value="true"
  />
  <!-- enable screenshot for crashes -->
  <meta-data
    android:name="io.sentry.attach-screenshot"
    android:value="true"
  />
  <!-- enable view hierarchy for crashes -->
  <meta-data
    android:name="io.sentry.attach-view-hierarchy"
    android:value="true"
  />

  <!-- enable the performance API by setting a sample-rate, adjust in production env -->
  <meta-data
    android:name="io.sentry.traces.sample-rate"
    android:value="1.0"
  />
  <!-- enable profiling when starting transactions, adjust in production env -->
  <meta-data
    android:name="io.sentry.traces.profiling.sample-rate"
    android:value="1.0"
  />
  <!-- enable app start profiling -->
  <meta-data
    android:name="io.sentry.traces.profiling.enable-app-start"
    android:value="true"
  />
</application>

Under the hood, Sentry uses a ContentProvider to initialize the SDK based on the values provided above. This way, the SDK can capture important crashes and metrics right from the app start.

Additional options can be found on our dedicated options page.

If you want to customize the SDK init behaviour, you can still use the Manual Initialization method.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").