# EmulatorSnapshots

# EmulatorSnapshots

```
@Incubating interface EmulatorSnapshots
```

|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [com.android.build.api.dsl.EmulatorSnapshots](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/EmulatorSnapshots#) |

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [FailureRetention](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/FailureRetention) |-----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------| | [FailureRetention](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/FailureRetention) | Options for configuring Android Test Retention. | |

Options for configuring Android Test Retention.

When enabled, Android Test Retention automatically takes emulator snapshots on test failures.

## Summary

|                                                                                                                                                                 ### Public methods                                                                                                                                                                  ||
|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [retainAll](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/EmulatorSnapshots#retainAll())`()` Call this function to take unlimited number of test failure snapshots (will ignore maxSnapshotsForTestFailures setting) |

|                                                                                                                                                          ### Properties                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [compressSnapshots](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/EmulatorSnapshots#compressSnapshots:kotlin.Boolean) Enables snapshot compression.                                         |
| abstract[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [enableForTestFailures](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/EmulatorSnapshots#enableForTestFailures:kotlin.Boolean) Enables automated test failure snapshots.                     |
| abstract[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [maxSnapshotsForTestFailures](https://developer.android.com/reference/tools/gradle-api/7.1/com/android/build/api/dsl/EmulatorSnapshots#maxSnapshotsForTestFailures:kotlin.Int) Maximum number of failures that would be snapshotted. |

## Public methods

### retainAll

```
abstract fun retainAll(): Unit
```

Call this function to take unlimited number of test failure snapshots (will ignore maxSnapshotsForTestFailures setting)

## Properties

### compressSnapshots

```
abstract var compressSnapshots: Boolean
```

Enables snapshot compression. Default to false.  

### enableForTestFailures

```
abstract var enableForTestFailures: Boolean
```

Enables automated test failure snapshots. Default to false.  

### maxSnapshotsForTestFailures

```
abstract var maxSnapshotsForTestFailures: Int
```

Maximum number of failures that would be snapshotted. Any failures after the first $maxSnapshotsForTestFailures will not have snapshots. Default to 2. Must be \>0