# Manual Setup | Sentry for Android

If you can't (or prefer not to) run the [automatic setup](https://docs.sentry.io/platforms/android.md#install), you can follow the instructions below to configure your application manually.

## [Installation](https://docs.sentry.io/platforms/android/manual-setup.md#installation)

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`

```groovy
plugins {
  id "com.android.application"
  id "io.sentry.android.gradle" version "5.12.2"
}
```

Version `5.12.2` of the plugin will automatically add the Sentry Android SDK (version `8.30.0`) to your app.

## [Configuration](https://docs.sentry.io/platforms/android/manual-setup.md#configuration)

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

`AndroidManifest.xml`

```xml
<application>
  <!-- Required: set your sentry.io project identifier (DSN) -->
  <meta-data
    android:name="io.sentry.dsn"
    android:value="___PUBLIC_DSN___"
  />

  <!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
  <meta-data
    android:name="io.sentry.send-default-pii"
    android:value="true"
  />

  <!-- 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 UI profiling, adjust in production env. This is evaluated only once per session -->
  <meta-data
    android:name="io.sentry.traces.profiling.session-sample-rate"
    android:value="1.0"
  />
  <!-- Set profiling mode. For more info see https://docs.sentry.io/platforms/android/profiling/#enabling-ui-profiling -->
  <meta-data
    android:name="io.sentry.traces.profiling.lifecycle"
    android:value="trace"
  />
  <!-- Enable profiling on app start. The app start profile will be stopped automatically when the app start root span finishes -->
  <meta-data
    android:name="io.sentry.traces.profiling.start-on-app-start"
    android:value="true"
  />

  <!-- record session replays for 100% of errors and 10% of sessions -->
  <meta-data
    android:name="io.sentry.session-replay.on-error-sample-rate"
    android:value="1.0"
  />
  <meta-data
    android:name="io.sentry.session-replay.session-sample-rate"
    android:value="0.1"
  />
</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](https://docs.sentry.io/platforms/android/configuration/options.md).

If you want to customize the SDK init behaviour, you can still use the [Manual Initialization method](https://docs.sentry.io/platforms/android/configuration/manual-init.md).
