From 6684a73792604852b1e96ca81ea4a92cb246e2bd Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Tue, 21 Apr 2026 15:30:20 +0200 Subject: [PATCH] docs(snapshots): Add Android setup guide (EME-1031) Document how to set up snapshot testing for Android apps using the Sentry Android Gradle Plugin. Covers enabling snapshots, connecting Paparazzi, Roborazzi, and other snapshot tools, and verifying the setup locally before integrating into CI. --- docs/product/snapshots/android/index.mdx | 104 +++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 docs/product/snapshots/android/index.mdx diff --git a/docs/product/snapshots/android/index.mdx b/docs/product/snapshots/android/index.mdx new file mode 100644 index 00000000000000..affa3e9ca819b1 --- /dev/null +++ b/docs/product/snapshots/android/index.mdx @@ -0,0 +1,104 @@ +--- +title: Android +sidebar_order: 30 +description: Set up snapshot testing for Android apps with the Sentry Android Gradle Plugin. +--- + + + +Set up snapshot testing 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 check status updates. + +## Step 1: Enable Snapshots + +Ensure the [Sentry Android Gradle Plugin](/platforms/android/configuration/gradle/) version 6.4.0 or higher is applied and configured. + +Then enable snapshots in your `build.gradle`: + +```kotlin +sentry { + snapshots { + enabled = true + } +} +``` + +## Step 2: Connect Your Snapshot Tool + +### Paparazzi (Recommended) + +If you already have [Paparazzi](https://github.com/cashapp/paparazzi) configured, add `generateSnapshotTests = false` to your snapshot config: + +```kotlin +sentry { + snapshots { + enabled = true + generateSnapshotTests = false + } +} +``` + +Then continue to [Step 3](#step-3-test-locally). + +--- + +If you don't have Paparazzi yet, first choose a 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 integrates with ComposePreviewScanner to automatically generate snapshots for all Compose Previews in your project — no test-writing required. + +Then continue to [Step 3](#step-3-test-locally). + +### 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("sentryUploadSnapshotsDebug") { + dependsOn(tasks.named("recordRoborazziDebug")) + snapshotsPath.set( + project.extensions.getByType().outputDir + ) + } +} +``` + +Then continue to [Step 3](#step-3-test-locally). + +### 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("sentryUploadSnapshotsDebug") { + dependsOn(tasks.named("yourSnapshotTask")) + snapshotsPath.set(layout.projectDirectory.dir("path/to/snapshots")) + } +} +``` + +Alternatively, you can use `sentry-cli` directly to upload images. See [Uploading Snapshots](/product/snapshots/uploading-snapshots/) for the general upload structure. + +## Step 3: Test Locally + +Verify your setup by running: + +```bash +./gradlew sentryUploadSnapshotsDebug +``` + +If that succeeds, you can proceed with integrating into CI. See [Uploading Snapshots](/product/snapshots/uploading-snapshots/#upload-with-ci) for an example CI workflow.