# ManagedVirtualDevice

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


```
@Incubating
interface ManagedVirtualDevice : Device
```

<br />

*** ** * ** ***

Device type for emulators to be managed by the Android Gradle Plugin.

When a device group containing this device is run for tests, Gradle will:

1. Automatically start up an emulator matching the device definition. Including downloading any and all required system image files and creating the avd.

2. Run the tests on this device.

3. Close the emulator upon completion.

These APIs are experimental and may change without notice.

## Summary

| ### Nested types |
|---|
| `@https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html enum https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice.PageAlignment : https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html<https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice.PageAlignment>` Defines possible system image selection strategies based on the requested Page Alignment |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#apiLevel()` The api level of Android to be run on the device. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#apiPreview()` The sdk version code of Android to be run on the device. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#device()` The hardware profile of the device to be emulated. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice.PageAlignment` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#pageAlignment()` What size pages the device should be aligned to. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#require64Bit()` Whether the image must be a 64 bit image. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkExtensionVersion()` The extension version of the system image to be run on the device. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` The SDK version code of Android to be run on the device. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()` The SDK version of Android to be run on the device. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#systemImageSource()` Which source the system image should come from. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#testedAbi()` What abi the apk should be built with to test against. |

### Inherited functions

From [com.android.build.api.dsl.Device](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/Device) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `@https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html
@https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/Internal.html
https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/Device#getName()()`

### Inherited properties

From [com.android.build.api.dsl.Device](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/Device) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/Device#name()`

## Public properties

### apiLevel

Added in 4.2.0

```
var apiLevel: Int
```

The api level of Android to be run on the device. This annotation is deprecated, use `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()` instead.

This specifies the sdk version of the device. Setting this value will override previous calls of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()`, `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()`, and `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#apiPreview()`.

See [uses-sdk element documentation](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html) for a list of valid values.

### apiPreview

Added in 8.0.2

```
var apiPreview: String?
```

The sdk version code of Android to be run on the device. This annotation is deprecated, use `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` instead.

Setting this it will override previous calls of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#apiLevel()`, `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#apiPreview()`, `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()`, and `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` setters.

See [uses-sdk element documentation](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html) for a list of valid values.

### device

Added in 4.2.0

```
var device: String
```

The hardware profile of the device to be emulated.

### pageAlignment

Added in 8.9.0

```
var pageAlignment: ManagedVirtualDevice.PageAlignment
```

What size pages the device should be aligned to.

By default, the system image that is validated against Google apis will be chosen. At present (api 35 or below) that is the 4KB page size system image. Newer apis will emit a warning when `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice.PageAlignment#DEFAULT_FOR_SDK_VERSION` is chosen (as we will not be able to properly determine the validated image when offline.)

### require64Bit

Added in 7.2.0

```
var require64Bit: Boolean
```

Whether the image must be a 64 bit image. Defaults to false.

On x86_64 machines: When false, the managed device will use the 32 bit image if available with the given api level and source, otherwise the 64 bit image will be used. When true, the 64 image must be used and setup will fail if an appropriate image does not exist. On arm machines: The value of this parameter has no effect. An arm64 image is always selected.

### sdkExtensionVersion

Added in 8.9.0

```
var sdkExtensionVersion: Int?
```

The extension version of the system image to be run on the device.

By default, the basic system image will be chosen for the given `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()`.

### sdkPreview

Added in 8.9.0

```
var sdkPreview: String?
```

The SDK version code of Android to be run on the device.

Setting this value will override previous calls of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()` or `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` setters. Only one of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()` and `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` should be set

See [uses-sdk element documentation](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html) for a list of valid values.

### sdkVersion

Added in 8.9.0

```
var sdkVersion: Int
```

The SDK version of Android to be run on the device.

Setting this value will override previous calls of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()` or `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` setters. Only one of `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkVersion()` and `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ManagedVirtualDevice#sdkPreview()` should be set

See [uses-sdk element documentation](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html) for a list of valid values.

### systemImageSource

Added in 4.2.0

```
var systemImageSource: String
```

Which source the system image should come from. Either "google", "google-atd", "aosp", or "aosp-atd". You can also specify an explicit source such as "google_apis_playstore".

"google", the default, will select Google APIs images for the device. "google-atd" will use automated test device images from Google APIs. "aosp" will use the Android Open Source Project images for the device. "aosp-atd" will use automated test device image from the Android Open Source Project.

### testedAbi

Added in 8.11.0

```
var testedAbi: String?
```

What abi the apk should be built with to test against.

This changes the abi of the testedApk to be installed on the given managed device. This should be changed to test native code. If the abi is not compatible with the system image, this will result in a failure.

The default is for the abi to match the abi of the system image (which is selected based on the abi of the host system). Certain system image sources, such as "google" or "google_apis_playstore" support NDK translation. This allows for the "arm64-v8a" apks to be installed and run on an "x86_64" system image.

Valid values include "x86", "x86_64", and "arm64-v8a"