---
title: "Snapshots"
description: "Set up snapshot testing for Android apps with the Sentry Android Gradle Plugin."
url: https://docs.sentry.io/platforms/android/snapshots/
---

# Set Up Snapshots | Sentry for Android

This feature is available only if you're in the [Early Adopter program](https://docs.sentry.io/organization/early-adopter-features.md). Features available to Early Adopters are still in-progress and may have bugs. We recognize the irony.

Set up [Snapshots](https://docs.sentry.io/product/snapshots.md) for your Android app with the Sentry Android Gradle Plugin. Run snapshot tests locally or in your own CI using your preferred snapshot library, then upload the generated images to Sentry for image diffing, visual review, and GitHub status checks.

## [Step 1: Enable Snapshots](https://docs.sentry.io/platforms/android/snapshots.md#step-1-enable-snapshots)

Ensure the [Sentry Android Gradle Plugin](https://docs.sentry.io/platforms/android/configuration/gradle.md) version 6.4.0 or higher is applied and configured.

Then enable snapshots in your `build.gradle`:

```kotlin
sentry {
  snapshots {
    enabled = true
  }
}
```

## [Step 2: Generate Images](https://docs.sentry.io/platforms/android/snapshots.md#step-2-generate-images)

There are two paths for generating snapshot images on Android:

* **From Compose Previews (recommended)** — if you don't have snapshot tests yet, Sentry auto-wires Paparazzi with ComposePreviewScanner so every `@Preview` composable becomes a snapshot. No test code required.
* **From existing snapshot tests** — if you already use Paparazzi, Roborazzi, or another tool, point Sentry at your existing output instead.

### [From Compose Previews (Recommended)](https://docs.sentry.io/platforms/android/snapshots.md#from-compose-previews-recommended)

Use this path if you don't have a snapshot test suite yet. Paparazzi and ComposePreviewScanner turn every `@Preview` composable in your project into a snapshot automatically.

First, choose a Paparazzi version compatible with your project:

| Version         | Gradle         | compileSdk | JDK | compose-bom  |
| --------------- | -------------- | ---------- | --- | ------------ |
| `2.0.0-alpha04` | 9.1.x or 9.2.x | 36         | 21+ | > 2025.05.00 |
| `1.3.5`         | 8.x or 9.x     | ≤ 35       | 17+ | ≤ 2025.04.00 |

Then apply the plugin:

```kotlin
plugins {
  // existing plugins
  id("app.cash.paparazzi") version "<paparazzi_version>"
}
```

#### [Customize Preview Generation](https://docs.sentry.io/platforms/android/snapshots.md#customize-preview-generation)

The `snapshots` block on the Sentry extension exposes two options that shape the generated Paparazzi tests. Both only apply when `generateSnapshotTests` is `true` (the default).

```kotlin
sentry {
  snapshots {
    enabled = true
    theme = "@style/Theme.MyApp"   // optional
    includePrivatePreviews = false // optional, defaults to true
  }
}
```

| Option                   | Default                                                             | Description                                                                                                                         |
| ------------------------ | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `theme`                  | Paparazzi default (`android:Theme.Material.NoActionBar.Fullscreen`) | Android theme resource used when rendering previews. Set this if your previews rely on a specific theme.                            |
| `includePrivatePreviews` | `true`                                                              | Whether `@Preview` composables declared `private` are snapshotted. Set to `false` to exclude in-progress or internal-only previews. |

If you don't set `theme`, Paparazzi uses its own default (`android:Theme.Material.NoActionBar.Fullscreen`). If the background of your previews isn't important — for example, when you just want to compare component geometry — you can use a translucent platform theme such as `android:Theme.Translucent.NoTitleBar`:

```kotlin
sentry {
  snapshots {
    enabled = true
    theme = "android:Theme.Translucent.NoTitleBar"
  }
}
```

If `theme` references a style the renderer can't resolve (typo, wrong prefix, or a theme not on the classpath), neither Sentry nor Paparazzi raises an error or warning. Snapshots still generate, but with incorrect visuals. Double-check the theme string if rendered output looks unexpected.

Continue to [Step 3](https://docs.sentry.io/platforms/android/snapshots.md#step-3-test-locally).

### [From Existing Snapshot Tests](https://docs.sentry.io/platforms/android/snapshots.md#from-existing-snapshot-tests)

Use this path if you already have a snapshot test suite. The configuration depends on which tool you use.

#### [Paparazzi](https://docs.sentry.io/platforms/android/snapshots.md#paparazzi)

If you already have [Paparazzi](https://github.com/cashapp/paparazzi) configured, set `generateSnapshotTests = false` so Sentry uses your existing tests instead of auto-generating preview-based ones:

```kotlin
sentry {
  snapshots {
    enabled = true
    generateSnapshotTests = false
  }
}
```

Continue to [Step 3](https://docs.sentry.io/platforms/android/snapshots.md#step-3-test-locally).

#### [Roborazzi](https://docs.sentry.io/platforms/android/snapshots.md#roborazzi)

If you already have [Roborazzi](https://github.com/takahirom/roborazzi) configured, wire the Sentry upload task to the output of your Roborazzi record task:

```kotlin
afterEvaluate {
  tasks.named<SentryUploadSnapshotsTask>("sentryUploadSnapshotsDebug") {
    dependsOn(tasks.named("recordRoborazziDebug"))
    snapshotsPath.set(
      project.extensions.getByType<RoborazziExtension>().outputDir
    )
  }
}
```

Continue to [Step 3](https://docs.sentry.io/platforms/android/snapshots.md#step-3-test-locally).

#### [Other Tools](https://docs.sentry.io/platforms/android/snapshots.md#other-tools)

The same pattern works with any snapshot tool. Set `snapshotsPath` to the directory your tool writes images to, and add a `dependsOn` for the task that generates them:

```kotlin
afterEvaluate {
  tasks.named<SentryUploadSnapshotsTask>("sentryUploadSnapshotsDebug") {
    dependsOn(tasks.named("yourSnapshotTask"))
    snapshotsPath.set(layout.projectDirectory.dir("path/to/snapshots"))
  }
}
```

Alternatively, you can skip the Gradle plugin entirely and upload with [`sentry-cli build snapshots`](https://docs.sentry.io/cli/snapshots.md):

```bash
sentry-cli build snapshots ./build/paparazzi/snapshots \
  --app-id android-app
```

Use this path if your build pipeline doesn't use Gradle, or if you want to run the upload outside of a Gradle task. See [Uploading Snapshots](https://docs.sentry.io/product/snapshots/uploading-snapshots.md) for the expected directory layout.

## [Step 3: Test Locally](https://docs.sentry.io/platforms/android/snapshots.md#step-3-test-locally)

Verify your setup by running:

```bash
./gradlew sentryUploadSnapshotsDebug
```

## [Step 4: Integrate Into CI](https://docs.sentry.io/platforms/android/snapshots.md#step-4-integrate-into-ci)

Once the local upload succeeds, wire the same command into your CI. See [Uploading Snapshots](https://docs.sentry.io/product/snapshots/uploading-snapshots.md#upload-with-ci) for an example GitHub Actions workflow.
