# Variant

# Variant

```
interface Variant : Component, HasAndroidResources
```

|----------------------------------------------------------------------------------------------------------------------------------------------|
| [com.android.build.api.variant.Variant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#) |

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [ApplicationVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ApplicationVariant),[DynamicFeatureVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/DynamicFeatureVariant),[LibraryVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/LibraryVariant),[TestVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/TestVariant) |-------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| | [ApplicationVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ApplicationVariant)       | Properties for the main Variant of an application.                                                                                   | | [DynamicFeatureVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/DynamicFeatureVariant) | <br />                                                                                                                               | | [LibraryVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/LibraryVariant)               | [Variant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#)for Library projects   | | [TestVariant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/TestVariant)                     | [Variant](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#)for test-only modules. | |

Parent interface for all types of variants.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstractT? | [getExtension](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#getExtension(java.lang.Class))`(`type:` `[Class](http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html)<T>`)` Returns an extension object registered via the[VariantBuilder.registerExtension](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#registerExtension(java.lang.Class,%20com.android.build.api.variant.VariantBuilder.registerExtension.T))API or null if none were registered under the passed[type](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#com.android.build.api.variant.Variant$getExtension(java.lang.Class((com.android.build.api.variant.Variant.getExtension.T)))/type). |

| ### Inherited functions ||
|---|---|
| From class[HasAndroidResources](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/HasAndroidResources) |-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ResValue.Key](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ResValue.Key) | [makeResValueKey](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/HasAndroidResources#makeResValueKey(kotlin.String,%20kotlin.String))`(`type:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` <br /> Make a[ResValue.Key](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ResValue.Key)to interact with[resValues](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/HasAndroidResources#resValues:org.gradle.api.provider.MapProperty)'s[MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html) <br /> | ||

|                                                                                                                                                                                                                                                                                                                                                                                                                                         ### Properties                                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),[BuildConfigField](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/BuildConfigField)\<out[Serializable](http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)\>\> | [buildConfigFields](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#buildConfigFields:org.gradle.api.provider.MapProperty) Variant's[BuildConfigField](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/BuildConfigField)which will be generated in the BuildConfig class.                                                                                                   |
| abstract[MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.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/7.0/com/android/build/api/variant/Variant#experimentalProperties:org.gradle.api.provider.MapProperty) Additional per variant experimental properties.                                                                                                                                                                                                                                   |
| abstract[ExternalNativeBuild](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ExternalNativeBuild)?                                                                                                                                                                                                                                                                       | [externalNativeBuild](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#externalNativeBuild:com.android.build.api.variant.ExternalNativeBuild) Variant's cmake[ExternalNativeBuild](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ExternalNativeBuild), initialized by merging the product flavor values or null if no cmake external build is configured for this variant. |
| abstract[MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html),[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)\>                                                                                                                                         | [manifestPlaceholders](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#manifestPlaceholders:org.gradle.api.provider.MapProperty) [MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)of the variant's manifest placeholders.                                                                                                                                                |
| abstract[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)?                                                                                                                                                                                                                                                                                                                                  | [maxSdkVersion](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#maxSdkVersion:kotlin.Int) Gets the maximum supported SDK Version for this variant.                                                                                                                                                                                                                                                                     |
| abstract[AndroidVersion](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/AndroidVersion)                                                                                                                                                                                                                                                                                  | [minSdkVersion](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#minSdkVersion:com.android.build.api.variant.AndroidVersion) Gets the minimum supported SDK Version for this variant.                                                                                                                                                                                                                                   |
| abstract[Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)\>                                                                                                                                                                                                                                | [namespace](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#namespace:org.gradle.api.provider.Provider) The namespace of the generated R and BuildConfig classes.                                                                                                                                                                                                                                                      |
| abstract[Packaging](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Packaging)                                                                                                                                                                                                                                                                                            | [packaging](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#packaging:com.android.build.api.variant.Packaging) Variant's packagingOptions, initialized by the corresponding global DSL element.                                                                                                                                                                                                                        |
| abstract[ListProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/ListProperty.html)\<[RegularFile](https://docs.gradle.org/current/javadoc/org/gradle/api/file/RegularFile.html)\>                                                                                                                                                                                                             | [proguardFiles](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#proguardFiles:org.gradle.api.provider.ListProperty) List of proguard configuration files for this variant.                                                                                                                                                                                                                                             |
| abstract[AndroidVersion](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/AndroidVersion)                                                                                                                                                                                                                                                                                  | [targetSdkVersion](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#targetSdkVersion:com.android.build.api.variant.AndroidVersion) Gets the target SDK Version for this variant.                                                                                                                                                                                                                                        |
| abstract[UnitTest](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/component/UnitTest.html#)?                                                                                                                                                                                                                                                                                     | [unitTest](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#unitTest:com.android.build.api.component.UnitTest) Variant's[UnitTest](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/component/UnitTest.html#), or null if the unit tests for this variant are disabled.                                                                                                               |

| ### Inherited properties ||
|---|---|
| From class[HasAndroidResources](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/HasAndroidResources) |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Property](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html)<[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)>                                                                                                                                                               | [pseudoLocalesEnabled](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/HasAndroidResources#pseudoLocalesEnabled:org.gradle.api.provider.Property) <br /> Variant's is pseudo locales enabled, initialized by the corresponding DSL elements. <br />                                           | | [MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)<[ResValue.Key](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ResValue.Key),` `[ResValue](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ResValue)> | [resValues](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/HasAndroidResources#resValues:org.gradle.api.provider.MapProperty) <br /> Variant's[ResValue](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ResValue)which will be generated. <br /> | ||

## Public methods

### getExtension

```
abstract fun <T> getExtension(type: Class<T>): T?
```

Returns an extension object registered via the[VariantBuilder.registerExtension](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/VariantBuilder#registerExtension(java.lang.Class,%20com.android.build.api.variant.VariantBuilder.registerExtension.T))API or null if none were registered under the passed[type](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#com.android.build.api.variant.Variant$getExtension(java.lang.Class((com.android.build.api.variant.Variant.getExtension.T)))/type).

| Return ||
|---|---|
| the registered object or null. ||

## Properties

### buildConfigFields

```
abstract val buildConfigFields: MapProperty<String, BuildConfigField<out Serializable>>
```

Variant's[BuildConfigField](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/BuildConfigField)which will be generated in the BuildConfig class.  

### experimentalProperties

```
abstract val experimentalProperties: MapProperty<String, Any>
```

Additional per variant experimental properties.

Initialized from[com.android.build.api.dsl.CommonExtension.experimentalProperties](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/CommonExtension.html#experimentalProperties:kotlin.collections.MutableMap)  

### externalNativeBuild

```
abstract val externalNativeBuild: ExternalNativeBuild?
```

Variant's cmake[ExternalNativeBuild](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/ExternalNativeBuild), initialized by merging the product flavor values or null if no cmake external build is configured for this variant.  

### manifestPlaceholders

```
abstract val manifestPlaceholders: MapProperty<String, String>
```

[MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)of the variant's manifest placeholders.

Placeholders are organized with a key and a value. The value is a[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)that will be used as is in the merged manifest.

| Return ||
|---|---|
| the[MapProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/MapProperty.html)with keys as[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) ||

### maxSdkVersion

```
abstract val maxSdkVersion: Int?
```

Gets the maximum supported SDK Version for this variant.  

### minSdkVersion

```
abstract val minSdkVersion: AndroidVersion
```

Gets the minimum supported SDK Version for this variant.  

### namespace

```
abstract val namespace: Provider<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.

This value supersedes any value specified by the`package`attribute in the source AndroidManifest.xml, but doing a 'get' on this property will not retrieve the value specified in the AndroidManifest.xml.  

### packaging

```
abstract val packaging: Packaging
```

Variant's packagingOptions, initialized by the corresponding global DSL element.  

### proguardFiles

```
abstract val proguardFiles: ListProperty<RegularFile>
```

List of proguard configuration files for this variant. The list is initialized from the corresponding DSL element, and cannot be queried at configuration time. At configuration time, you can only add new elements to the list.

This list will be initialized from[com.android.build.api.dsl.VariantDimension#proguardFile](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/variant/Variant#)for non test related variants and from[com.android.build.api.dsl.VariantDimension.testProguardFiles](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/VariantDimension.html#testProguardFiles(kotlin.Any))for test related variants.  

### targetSdkVersion

```
abstract val targetSdkVersion: AndroidVersion
```

Gets the target SDK Version for this variant.  

### unitTest

```
abstract val unitTest: UnitTest?
```

Variant's[UnitTest](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/component/UnitTest.html#), or null if the unit tests for this variant are disabled.