Sentry Android Gradle Plugin (AGP)

Learn how to configure the Sentry Android Gradle Plugin to automatically upload source maps and debug symbols for your Expo project.

To enable the plugin modify the Expo application configuration and add the enableAndroidGradlePlugin option in the @sentry/react-native/expo plugin section.

Copied
{
  "expo": {
    "plugins": [
      [
        "@sentry/react-native/expo",
        {
          "url": "https://sentry.io/",
          "project": "example-project",
          "organization": "example-org"
          "experimental_android": {
            "enableAndroidGradlePlugin": true,
          }
        }
      ],
  }
}

You can configure the Sentry Android Gradle Plugin by passing an options object to the experimental_android key in the plugin configuration.

Copied
{
  "expo": {
...
    "plugins": [
      [
        "@sentry/react-native/expo",
        {
...
          "experimental_android": {
            "enableAndroidGradlePlugin": true,
            "autoUploadProguardMapping": true,
            "includeProguardMapping": true,
            "dexguardEnabled": true,
            "uploadNativeSymbols": true,
            "autoUploadNativeSymbols": true,
            "includeNativeSources": true,
            "includeSourceContext": true,
          }
        }
      ],
...
  }
}

This option specifies whether the plugin should attempt to auto-upload the mapping file to Sentry or not. If disabled the plugin will run a dry-run and just generate a UUID. The mapping file has to be uploaded manually via sentry-cli in this case. Default is enabled.

Disables or enables the handling of Proguard mapping for Sentry. If enabled the plugin will generate a UUID and will take care of uploading the mapping to Sentry. If disabled, all the logic related to proguard mapping will be excluded. Default is enabled.

Experimental flag to turn on support for GuardSquare's tools integration (Dexguard and External Proguard). If enabled, the plugin will try to consume and upload the mapping file produced by Dexguard and External Proguard. Default is disabled.

Disables or enables the automatic configuration of Native Symbols for Sentry. This executes sentry-cli automatically so you don't need to do it manually. Default is disabled.

Defines whether the plugin should attempt to auto-upload the native debug symbols to Sentry or not. If disabled the plugin will run a dry-run. Default is enabled.

Does or doesn't include the source code of native code for Sentry. This executes sentry-cli with the --include-sources param. automatically so you don't need to do it manually. This option has an effect only when uploadNativeSymbols is enabled. Default is disabled.

Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry. This enables source context, allowing you to see your source code as part of your stack traces in Sentry.

Was this helpful?
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").