# AndroidTestBuilder

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


```
interface AndroidTestBuilder : DeviceTestBuilder
```

<br />

*** ** * ** ***

## Summary

| ### Public properties |
|---|---|
| `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/variant/AndroidTestBuilder#enable()` Set to `true` if the variant's has any android tests, false otherwise. |
| `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/variant/AndroidTestBuilder#enableMultiDex()` **The getter for this property is deprecated.** Other plugins can change this value, it is not safe to read it at this stage |

### Inherited properties

From [com.android.build.api.variant.DeviceTestBuilder](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/DeviceTestBuilder) `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/variant/DeviceTestBuilder#enableCodeCoverage()`

**The getter for this property is deprecated.** Other plugins can change this value, it is not safe to read it at this stage, use \[DeviceTest.codeCoverageEnabled\]
From [com.android.build.api.variant.GeneratesApkBuilder](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/GeneratesApkBuilder) `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/variant/GeneratesApkBuilder#debuggable()`

**The getter for this property is deprecated.** Other plugins can change this value, it is not safe to read it at this stage
`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/variant/GeneratesApkBuilder#targetSdk()`

Sets the target SDK Version for this variant as an integer API level.
`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/variant/GeneratesApkBuilder#targetSdkPreview()`

Sets the target SDK Version for this variant as an integer API level.

## Public properties

### enable

Added in 8.3.1

```
var enable: Boolean
```

Set to `true` if the variant's has any android tests, false otherwise. Value is Boolean#True by default.

### enableMultiDex

Added in 8.3.1 Deprecated in 8.3.1

```
var enableMultiDex: Boolean?
```

> [!CAUTION]
> **The getter for this property is deprecated.**   
> Other plugins can change this value, it is not safe to read it at this stage

Sets whether multi-dex is enabled for this variant.

This can be null, in which case the default value is used.

It is not safe to read the value of this property as other plugins that were applied later can change this value so there is no guarantee you would get the final value. To get the final value, use the `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/AndroidComponentsExtension#onVariants(com.android.build.api.variant.VariantSelector,kotlin.Function1)` API :

```
onVariants { variant ->
  variant.dexing.isMultiDexEnabled
}
```

Note the a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-runtime-exception/index.html` will be thrown at Runtime if a java or groovy code tries to read the property value.