---
updatedAt: 2026-03-16T23:46:22.000Z
agentTools:
  projectIndex: https://docs.emergetools.com/llms.txt
---

# Local generation

# iOS

Emerge offers a Swift package to generate snapshots locally for your own debugging. For example, this can be helpful if you have a preview that crashes while rendering.

To get started:

* Install the [Swift Package](https://github.com/EmergeTools/SnapshotPreviews-iOS) in your project
* Add a UI test target with `SnapshottingTests` as a dependency.
* Create your test that inherits from `SnapshottingTests.PreviewTest`

See [the repo](https://github.com/EmergeTools/SnapshotPreviews-iOS/tree/main) for full documentation.

# Android

Emerge offers a gradle task to generate snapshots locally for debugging or saving locally. You'll need a running emulator or connected device to run the local snapshot generation. Make sure the `ANDROID_HOME` variable is set on your `PATH` to the Android SDK location on your system, as this task relies on ADB to execute.

```shell
./gradlew :app:emergeLocalSnapshotsDebug
```

Additionally, you can specify where to save the snapshots to using the `snapshots` extension of the Emerge Gradle plugin. By default, snapshots are saved to the `/build/emergetools/snapshots/outputs` directory.

```kotlin build.gradle.kts (root)
emerge {
  ..
  
  snapshots {
    snapshotsStorageDirectory.set("/app/src/main/snapshots") // Storage of locally generated snapshots
  }
}
```

### Run specific previews locally

The `--preview` argument can be passed to test specific preview functions. You can specify a single preview or multiple, separating each value with a comma.

```shell
./gradlew :app:emergeLocalSnapshotsDebug --preview com.example.test.MyPreview

./gradlew :app:emergeLocalSnapshotsDebug --preview com.example.test.MyPreview,com.example.test.MyPreview2
```

<br />