# KotlinMultiplatformAndroidVariant

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


```
@Incubating
interface KotlinMultiplatformAndroidVariant : HasDeviceTests, HasAndroidTest, HasUnitTest, HasHostTests
```

<br />

*** ** * ** ***

Properties for the main Variant of a kotlin multiplatform android library

## Summary

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/artifact/Artifacts` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/KotlinMultiplatformAndroidVariant#artifacts()` Access to the variant's buildable artifacts for build customization. |
| `https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/KotlinMultiplatformAndroidVariant#compileClasspath()` Access to the variant's compile classpath. |
| `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/Instrumentation` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/KotlinMultiplatformAndroidVariant#instrumentation()` Access to the variant's instrumentation options. |
| `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/LifecycleTasks` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/KotlinMultiplatformAndroidVariant#lifecycleTasks()` Provides access to the `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/LifecycleTasks` created for this component. |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/KotlinMultiplatformAndroidVariant#name()` The name of the variant |
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/Component>` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/KotlinMultiplatformAndroidVariant#nestedComponents()` List of the components nested in the main variant, the returned list may contain: |

| ### Inherited properties |
|---|
| From [com.android.build.api.variant.HasAndroidTest](https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasAndroidTest) |---|---| | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/AndroidTest?` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasAndroidTest#androidTest()` Variant's `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/AndroidTest` configuration, or null if android tests are disabled for this variant. | | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/TestedComponentPackaging` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasAndroidTest#packaging()` Variant's packagingOptions, initialized by the corresponding global DSL element. | |
| From [com.android.build.api.variant.HasDeviceTests](https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasDeviceTests) |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/DeviceTest>` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasDeviceTests#deviceTests()` Variant's `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/DeviceTest` configurations, or empty if all devices tests (like android tests) are disabled for this variant. | |
| From [com.android.build.api.variant.HasHostTests](https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasHostTests) |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HostTest>` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasHostTests#hostTests()` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html` of Variant's `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HostTest`, or empty if all host tests (like unit test) for this variant are disabled. | |
| From [com.android.build.api.variant.HasUnitTest](https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasUnitTest) |---|---| | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/UnitTest?` | `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasUnitTest#unitTest()` Variant's `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/UnitTest`, or null if the unit tests for this variant are disabled. | |

## Public properties

### artifacts

Added in 8.2.0

```
val artifacts: Artifacts
```

Access to the variant's buildable artifacts for build customization.

### compileClasspath

Added in 8.2.0

```
val compileClasspath: FileCollection
```

Access to the variant's compile classpath.

The returned `https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html` should not be resolved until execution time.

### instrumentation

Added in 8.2.0

```
val instrumentation: Instrumentation
```

Access to the variant's instrumentation options.

### lifecycleTasks

Added in 8.3.1

```
val lifecycleTasks: LifecycleTasks
```

Provides access to the `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/LifecycleTasks` created for this component.

### name

Added in 8.2.0

```
val name: String
```

The name of the variant

### nestedComponents

Added in 8.3.1

```
val nestedComponents: List<Component>
```

List of the components nested in the main variant, the returned list may contain:

- `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/UnitTest` component if the unit tests for this variant are enabled,

- `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/AndroidTest` component if this variant `https://developer.android.com/reference/tools/gradle-api/8.6/com/android/build/api/variant/HasDeviceTests` and android tests for this variant are enabled,

Use this list to do operations on all nested components of this variant without having to manually check whether the variant has each component.

Example:

```kotlin
androidComponents {
   onVariant { variant ->
       variant.nestedComponents.forEach { component ->
           component.instrumentation.transformClassesWith(
               AsmClassVisitorFactoryImpl.class,
               InstrumentationScope.Project) { params -> params.x = "value" }
           instrumentation.setAsmFramesComputationMode(COMPUTE_FRAMES_FOR_INSTRUMENTED_METHODS)
       }
   }
}
```