# KotlinMultiplatformAndroidExtension

# KotlinMultiplatformAndroidExtension

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

<br />

```
@Incubating
interface KotlinMultiplatformAndroidExtension
```

<br />

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

|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [KotlinMultiplatformAndroidTarget](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTarget) |   |

*** ** * ** ***

Extension properties for Kotlin multiplatform Android libraries.

Only the Kotlin Multiplatform Android Plugin should create instances of this interface.

Warning: this is an experimental API and will change in the near future, and you shouldn't publish plugins depending on it.

## Summary

|                                                                                                                                               ### Public functions                                                                                                                                               |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [aarMetadata](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#aarMetadata(kotlin.Function1))`(action: `[AarMetadata](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/AarMetadata)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Options for configuring AAR metadata.                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [dependencyVariantSelection](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#dependencyVariantSelection(kotlin.Function1))`(action: `[DependencyVariantSelection](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/DependencyVariantSelection)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Specifies options for doing variant selection for external Android dependencies based on build types and product flavours                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [lint](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#lint(kotlin.Function1))`(action: `[Lint](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Lint)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Specifies options for the lint tool.                                                                                                                                                                                                                      |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [optimization](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#optimization(kotlin.Function1))`(action: `[KmpOptimization](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KmpOptimization)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Specifies options for the R8/D8 optimization tool.                                                                                                                                                                  |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [packaging](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#packaging(kotlin.Function1))`(action: `[Packaging](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Packaging)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Specifies options and rules that determine which files the Android plugin packages into your APK.                                                                                                                                     |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [useLibrary](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#useLibrary(kotlin.String))`(name: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Includes the specified library to the classpath.                                                                                                                                                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [useLibrary](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#useLibrary(kotlin.String,kotlin.Boolean))`(name: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, required: `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Includes the specified library to the classpath.                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [withAndroidTestOnDevice](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#withAndroidTestOnDevice(kotlin.Function1))`(action: `[KotlinMultiplatformAndroidTestOnDevice](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDevice)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Creates and configures a compilation for tests that run on the device (previously referred to as instrumented tests).                           |
| [HasConfigurableValue](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/HasConfigurableValue)`<`[KotlinMultiplatformAndroidTestOnDevice](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDevice)`>` | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [withAndroidTestOnDeviceBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#withAndroidTestOnDeviceBuilder(kotlin.Function1))`(action: `[KotlinMultiplatformAndroidCompilationBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidCompilationBuilder)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Creates and configures a compilation for tests that run on the device (previously referred to as instrumented tests). |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                     | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [withAndroidTestOnJvm](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#withAndroidTestOnJvm(kotlin.Function1))`(action: `[KotlinMultiplatformAndroidTestOnJvm](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Creates and configures a compilation for tests that run on the JVM (previously referred to as unit tests).                                                  |
| [HasConfigurableValue](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/HasConfigurableValue)`<`[KotlinMultiplatformAndroidTestOnJvm](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm)`>`       | `@`[Incubating](https://docs.gradle.org/current/javadoc/org/gradle/api/Incubating.html) [withAndroidTestOnJvmBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#withAndroidTestOnJvmBuilder(kotlin.Function1))`(action: `[KotlinMultiplatformAndroidCompilationBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidCompilationBuilder)`.() `->` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` Creates and configures a compilation for tests that run on the JVM (previously referred to as unit tests).                  |

|                                                                                                                           ### Public properties                                                                                                                           |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AarMetadata](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/AarMetadata)                                                                                                                                                         | [aarMetadata](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#aarMetadata()) Options for configuring AAR metadata.                                                                                                                       |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                                                                                                                          | [buildToolsVersion](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#buildToolsVersion()) Specifies the version of the[SDK Build Tools](https://developer.android.com/studio/releases/build-tools.html)to use when building your project. |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`?`                                                                                                                                                                                             | [compileSdk](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#compileSdk()) Specifies the API level to compile your project against.                                                                                                      |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`?`                                                                                                                                                                                             | [compileSdkExtension](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#compileSdkExtension())                                                                                                                                             |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                       | [compileSdkPreview](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#compileSdkPreview())                                                                                                                                                 |
| [DependencyVariantSelection](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/DependencyVariantSelection)                                                                                                                           | [dependencyVariantSelection](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#dependencyVariantSelection()) Specifies options for doing variant selection for external Android dependencies based on build types and product flavours     |
| [MutableMap](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-map/index.html)`<`[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`>` | [experimentalProperties](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#experimentalProperties()) Additional per module experimental properties.                                                                                        |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                        | [isCoreLibraryDesugaringEnabled](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#isCoreLibraryDesugaringEnabled()) Whether core library desugaring is enabled.                                                                           |
| [Lint](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Lint)                                                                                                                                                                       | [lint](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#lint()) Specifies options for the lint tool.                                                                                                                                      |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`?`                                                                                                                                                                                             | [maxSdk](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#maxSdk()) The maxSdkVersion, or null if not specified.                                                                                                                          |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`?`                                                                                                                                                                                             | [minSdk](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#minSdk()) The minimum SDK version.                                                                                                                                              |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                       | [minSdkPreview](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#minSdkPreview())                                                                                                                                                         |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                       | [namespace](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#namespace()) The namespace of the generated R and BuildConfig classes.                                                                                                       |
| [KmpOptimization](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KmpOptimization)                                                                                                                                                 | [optimization](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#optimization()) Specifies options for the R8/D8 optimization tool.                                                                                                        |
| [Packaging](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Packaging)                                                                                                                                                             | [packaging](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#packaging()) Specifies options and rules that determine which files the Android plugin packages into your APK.                                                               |
| [TestCoverage](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/TestCoverage)                                                                                                                                                       | [testCoverage](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#testCoverage()) Configure the gathering of code-coverage from tests.                                                                                                      |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                       | [testNamespace](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#testNamespace()) The namespace used by the android test and unit test components for the generated R and BuildConfig classes.                                            |

## Public functions

### aarMetadata

Added in 8.2.0-beta03  

```
@Incubating
fun aarMetadata(action: AarMetadata.() -> Unit): Unit
```

Options for configuring AAR metadata.  

### dependencyVariantSelection

Added in 8.2.0-beta03  

```
@Incubating
fun dependencyVariantSelection(action: DependencyVariantSelection.() -> Unit): Unit
```

Specifies options for doing variant selection for external Android dependencies based on build types and product flavours

For more information about the properties you can configure in this block, see[DependencyVariantSelection](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/DependencyVariantSelection).  

### lint

Added in 8.2.0-beta03  

```
@Incubating
fun lint(action: Lint.() -> Unit): Unit
```

Specifies options for the lint tool.

For more information about the properties you can configure in this block, see[Lint](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Lint).  

### optimization

Added in 8.2.0-beta03  

```
@Incubating
fun optimization(action: KmpOptimization.() -> Unit): Unit
```

Specifies options for the R8/D8 optimization tool.

For more information about the properties you can configure in this block, see[KmpOptimization](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KmpOptimization).  

### packaging

Added in 8.2.0-beta03  

```
@Incubating
fun packaging(action: Packaging.() -> Unit): Unit
```

Specifies options and rules that determine which files the Android plugin packages into your APK.

For more information about the properties you can configure in this block, see[Packaging](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Packaging).  

### useLibrary

Added in 8.2.0-beta03  

```
@Incubating
fun useLibrary(name: String): Unit
```

Includes the specified library to the classpath.

You typically use this property to support optional platform libraries that ship with the Android SDK. The following sample adds the Apache HTTP API library to the project classpath:  

```kotlin
android {
    // Adds a platform library that ships with the Android SDK.
    useLibrary 'org.apache.http.legacy'
}
```

To include libraries that do not ship with the SDK, such as local library modules or binaries from remote repositories,[add the libraries as dependencies](https://developer.android.com/studio/build/dependencies.html)in the`dependencies`block. Note that Android plugin 3.0.0 and later introduce[new dependency configurations](https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations). To learn more about Gradle dependencies, read[Dependency Management Basics](https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html).  

|                                        Parameters                                        |
|------------------------------------------------------------------------------------------|--------------------------|
| `name: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | the name of the library. |

### useLibrary

Added in 8.2.0-beta03  

```
@Incubating
fun useLibrary(name: String, required: Boolean): Unit
```

Includes the specified library to the classpath.

You typically use this property to support optional platform libraries that ship with the Android SDK. The following sample adds the Apache HTTP API library to the project classpath:  

```kotlin
android {
    // Adds a platform library that ships with the Android SDK.
    useLibrary 'org.apache.http.legacy'
}
```

To include libraries that do not ship with the SDK, such as local library modules or binaries from remote repositories, "https://developer.android.com/studio/build/dependencies.html in the`dependencies`block. Note that Android plugin 3.0.0 and later introduce new dependency configurations. To learn more about Gradle dependencies, read[Dependency Management Basics](https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html)  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| `name: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)       | the name of the library.                                                                                  |
| `required: `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | if using the library requires a manifest entry, the entry will indicate that the library is not required. |

### withAndroidTestOnDevice

Added in 8.2.0-beta03  

```
@Incubating
fun withAndroidTestOnDevice(action: KotlinMultiplatformAndroidTestOnDevice.() -> Unit): Unit
```

Creates and configures a compilation for tests that run on the device (previously referred to as instrumented tests). Invoking this method will create a[KotlinMultiplatformAndroidTestOnDeviceCompilation](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDeviceCompilation)object with the following defaults:

- compilation name is "testOnDevice"

- default sourceSet name is "androidTestOnDevice" (sources would be located at`$project/src/androidTestOnDevice`)

- sourceSet tree is`null`, which means that the`commonTest`sourceSet will**not**be included in the compilation.

Only a single compilation of this test type can be created. If you want to configure[KotlinMultiplatformAndroidTestOnDevice](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDevice)options, you can modify it on the kotlin compilation as follows:  

```kotlin
kotlin {
  androidLibrary {
    compilations.withType(com.android.build.api.dsl.KotlinMultiplatformAndroidTestOnDevice::class.java) {
      // configure options
    }
  }
}
```  

### withAndroidTestOnDeviceBuilder

Added in 8.2.0-beta03  

```
@Incubating
fun withAndroidTestOnDeviceBuilder(action: KotlinMultiplatformAndroidCompilationBuilder.() -> Unit): HasConfigurableValue<KotlinMultiplatformAndroidTestOnDevice>
```

Creates and configures a compilation for tests that run on the device (previously referred to as instrumented tests). Invoking this method will create a[KotlinMultiplatformAndroidTestOnDeviceCompilation](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDeviceCompilation)object using the values set in the[KotlinMultiplatformAndroidCompilationBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidCompilationBuilder).

The returned object can be used to configure[KotlinMultiplatformAndroidTestOnDevice](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDevice)as follows:  

```kotlin
kotlin {
  androidLibrary {
    withAndroidTestOnDeviceBuilder {
      compilationName = "instrumentedTest"
      defaultSourceSetName = "androidInstrumentedTest"
    }.configure {
      instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }
  }
}
```

Only a single compilation of this test type can be created. If you want to configure[KotlinMultiplatformAndroidTestOnDevice](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnDevice)options, you can modify it on the kotlin compilation as follows:  

```kotlin
kotlin {
  androidLibrary {
    compilations.withType(com.android.build.api.dsl.KotlinMultiplatformAndroidTestOnDevice::class.java) {
      // configure options
    }
  }
}
```  

### withAndroidTestOnJvm

Added in 8.2.0-beta03  

```
@Incubating
fun withAndroidTestOnJvm(action: KotlinMultiplatformAndroidTestOnJvm.() -> Unit): Unit
```

Creates and configures a compilation for tests that run on the JVM (previously referred to as unit tests). Invoking this method will create a[KotlinMultiplatformAndroidTestOnJvmCompilation](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvmCompilation)object with the following defaults (You can change these defaults by using[withAndroidTestOnJvmBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#withAndroidTestOnJvmBuilder(kotlin.Function1))instead):

- compilation name is "testOnJvm"

- default sourceSet name is "androidTestOnJvm" (sources would be located at`$project/src/androidTestOnJvm`)

- sourceSet tree is`test`, which means that the`commonTest`sourceSet would be included in the compilation.

Only a single compilation of this test type can be created. If you want to configure[KotlinMultiplatformAndroidTestOnJvm](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm)options, you can modify it on the kotlin compilation as follows:  

```kotlin
kotlin {
  androidLibrary {
    compilations.withType(com.android.build.api.dsl.KotlinMultiplatformAndroidTestOnJvm::class.java) {
      // configure options
    }
  }
}
```  

### withAndroidTestOnJvmBuilder

Added in 8.2.0-beta03  

```
@Incubating
fun withAndroidTestOnJvmBuilder(action: KotlinMultiplatformAndroidCompilationBuilder.() -> Unit): HasConfigurableValue<KotlinMultiplatformAndroidTestOnJvm>
```

Creates and configures a compilation for tests that run on the JVM (previously referred to as unit tests). Invoking this method will create a[KotlinMultiplatformAndroidTestOnJvmCompilation](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvmCompilation)object using the values set in the[KotlinMultiplatformAndroidCompilationBuilder](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidCompilationBuilder).

The returned object can be used to configure[KotlinMultiplatformAndroidTestOnJvm](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm)as follows:  

```kotlin
kotlin {
  androidLibrary {
    withAndroidTestOnJvmBuilder {
      compilationName = "unitTest"
      defaultSourceSetName = "androidUnitTest"
    }.configure {
      isIncludeAndroidResources = true
    }
  }
}
```

Only a single compilation of this test type can be created. If you want to configure[KotlinMultiplatformAndroidTestOnJvm](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidTestOnJvm)options, you can modify it on the kotlin compilation as follows:  

```kotlin
kotlin {
  androidLibrary {
    compilations.withType(com.android.build.api.dsl.KotlinMultiplatformAndroidTestOnJvm::class.java) {
      // configure options
    }
  }
}
```  

## Public properties

### aarMetadata

Added in 8.2.0-beta03  

```
val aarMetadata: AarMetadata
```

Options for configuring AAR metadata.  

### buildToolsVersion

Added in 8.2.0-beta03  

```
var buildToolsVersion: String
```

Specifies the version of the[SDK Build Tools](https://developer.android.com/studio/releases/build-tools.html)to use when building your project.

By default, the plugin uses the minimum version of the build tools required by the[version of the plugin](https://developer.android.com/studio/releases/gradle-plugin.html#revisions)you're using. To specify a different version of the build tools for the plugin to use, specify the version as follows:  

```kotlin
android {
    // Specifying this property is optional.
    buildToolsVersion "26.0.0"
}
```

For a list of build tools releases, read[the release notes](https://developer.android.com/studio/releases/build-tools.html#notes).

Note that the value assigned to this property is parsed and stored in a normalized form, so reading it back may give a slightly different result.  

### compileSdk

Added in 8.2.0-beta03  

```
var compileSdk: Int?
```

Specifies the API level to compile your project against. The Android plugin requires you to configure this property.

This means your code can use only the Android APIs included in that API level and lower. You can configure the compile sdk version by adding the following to the`android`block:`compileSdk = 26`.

You should generally[use the most up-to-date API level](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)available. If you are planning to also support older API levels, it's good practice to[use the Lint tool](https://developer.android.com/studio/write/lint.html)to check if you are using APIs that are not available in earlier API levels.

The value you assign to this property is parsed and stored in a normalized form, so reading it back may return a slightly different value.  

### compileSdkExtension

Added in 8.2.0-beta03  

```
var compileSdkExtension: Int?
```  

### compileSdkPreview

Added in 8.2.0-beta03  

```
var compileSdkPreview: String?
```  

### dependencyVariantSelection

Added in 8.2.0-beta03  

```
val dependencyVariantSelection: DependencyVariantSelection
```

Specifies options for doing variant selection for external Android dependencies based on build types and product flavours

For more information about the properties you can configure in this block, see[DependencyVariantSelection](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/DependencyVariantSelection).  

### experimentalProperties

Added in 8.2.0-beta03  

```
val experimentalProperties: MutableMap<String, Any>
```

Additional per module experimental properties.  

### isCoreLibraryDesugaringEnabled

Added in 8.2.0-beta03  

```
var isCoreLibraryDesugaringEnabled: Boolean
```

Whether core library desugaring is enabled.  

### lint

Added in 8.2.0-beta03  

```
val lint: Lint
```

Specifies options for the lint tool.

For more information about the properties you can configure in this block, see[Lint](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Lint).  

### maxSdk

Added in 8.2.0-beta03  

```
var maxSdk: Int?
```

The maxSdkVersion, or null if not specified. This is only the value set on this produce flavor.

See[uses-sdk element documentation](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html).  

### minSdk

Added in 8.2.0-beta03  

```
var minSdk: Int?
```

The minimum SDK version. Setting this it will override previous calls of[minSdk](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#minSdk())and[minSdkPreview](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#minSdkPreview())setters. Only one of[minSdk](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#minSdk())and[minSdkPreview](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KotlinMultiplatformAndroidExtension#minSdkPreview())should be set.

See[uses-sdk element documentation](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html).  

### minSdkPreview

Added in 8.2.0-beta03  

```
var minSdkPreview: String?
```  

### namespace

Added in 8.2.0-beta03  

```
var namespace: String?
```

The namespace of the generated R and BuildConfig classes. Also, the namespace used to resolve any relative class names that are declared in the AndroidManifest.xml.  

### optimization

Added in 8.2.0-beta03  

```
val optimization: KmpOptimization
```

Specifies options for the R8/D8 optimization tool.

For more information about the properties you can configure in this block, see[KmpOptimization](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/KmpOptimization).  

### packaging

Added in 8.2.0-beta03  

```
val packaging: Packaging
```

Specifies options and rules that determine which files the Android plugin packages into your APK.

For more information about the properties you can configure in this block, see[Packaging](https://developer.android.com/reference/tools/gradle-api/8.5/com/android/build/api/dsl/Packaging).  

### testCoverage

Added in 8.2.0-beta03  

```
val testCoverage: TestCoverage
```

Configure the gathering of code-coverage from tests.  

### testNamespace

Added in 8.2.0-beta03  

```
var testNamespace: String?
```

The namespace used by the android test and unit test components for the generated R and BuildConfig classes.