# EmulatorSnapshots

# EmulatorSnapshots

[View Source](https://cs.android.com/search?q=file:com/android/build/api/dsl/EmulatorSnapshots.kt+class:com.android.build.api.dsl.EmulatorSnapshots)  
Added in 7.0.0  

<br />

```
@Incubating
interface EmulatorSnapshots
```

<br />

Known direct subclasses  
[FailureRetention](https://developer.android.com/reference/tools/gradle-api/8.8/com/android/build/api/dsl/FailureRetention)  

|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [FailureRetention](https://developer.android.com/reference/tools/gradle-api/8.8/com/android/build/api/dsl/FailureRetention) | **This interface is deprecated.**Renamed to EmulatorSnapshots |

*** ** * ** ***

Options for configuring Android Test Retention.

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

## Summary

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

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

## Public functions

### retainAll

Added in 7.0.0  

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

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

## Public properties

### compressSnapshots

Added in 7.0.0  

```
var compressSnapshots: Boolean
```

Enables snapshot compression. Default to false.  

### enableForTestFailures

Added in 7.0.0  

```
var enableForTestFailures: Boolean
```

Enables automated test failure snapshots. Default to false.  

### maxSnapshotsForTestFailures

Added in 7.0.0  

```
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