# VariantProperties

# VariantProperties

```
@Incubating interface VariantProperties : ComponentProperties
```

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

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [ApplicationVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/ApplicationVariantProperties),[DynamicFeatureVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/DynamicFeatureVariantProperties),[LibraryVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/LibraryVariantProperties),[TestVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/TestVariantProperties) |---------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------| | [ApplicationVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/ApplicationVariantProperties)       | Properties for the main Variant of an application.                                                                                                       | | [DynamicFeatureVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/DynamicFeatureVariantProperties) | <br />                                                                                                                                                   | | [LibraryVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/LibraryVariantProperties)               | [VariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#)for Library projects   | | [TestVariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/TestVariantProperties)                     | [VariantProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#)for test-only modules. | |

Parent interface for all types of variants.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                    ||
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [addBuildConfigField](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#addBuildConfigField(kotlin.String,%20java.io.Serializable,%20kotlin.String))`(`key:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[Serializable](http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)`, `comment:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Convenience method to add a new Build Config field which value is known at configuration time.                                                                                                                                                         |
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [addResValue](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#addResValue(kotlin.String,%20kotlin.String,%20kotlin.String,%20kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `type:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `comment:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Adds a ResValue element to the generated resources.                                                                                                               |
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [addResValue](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#addResValue(kotlin.String,%20kotlin.String,%20org.gradle.api.provider.Provider,%20kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `type:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `value:` `[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)>`, `comment:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?`)` Adds a ResValue element to the generated resources. |

|                                                                                                                                                                                                                                                                                                                                                                                             ### Properties                                                                                                                                                                                                                                                                                                                                                                                              ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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)\>                                                                                                                                                                                                                                | [applicationId](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#applicationId:org.gradle.api.provider.Provider) Variant's application ID as present in the final manifest file of the APK.                                                                                                                           |
| 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/4.1/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/4.1/com/android/build/api/variant/VariantProperties#buildConfigFields:org.gradle.api.provider.MapProperty) Variant's[BuildConfigField](https://developer.android.com/reference/tools/gradle-api/4.1/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),[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)\>                                                                                                                                         | [manifestPlaceholders](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#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[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)\>                                                                                                                                                                                                                                | [packageName](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/VariantProperties#packageName:org.gradle.api.provider.Provider) The package name into which some classes are generated                                                                                                                                                   |

| ### Inherited properties ||
|---|---|
| From class[ComponentProperties](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentProperties.html#) |--------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Artifacts](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifacts.html#) | [artifacts](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentProperties.html#artifacts:com.android.build.api.artifact.Artifacts) <br /> Access to the variant's buildable artifacts for build customization. <br /> | ||
| From class[ComponentIdentity](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentIdentity.html#) |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?                                                                                                                                                                                                                                                            | [buildType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentIdentity.html#buildType:kotlin.String) <br /> Build Type name, might be replaced with access to locked DSL object once ready <br />                                                                                                                                                                                      | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                                                                                                                                                                                             | [flavorName](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentIdentity.html#flavorName:kotlin.String) <br /> The multi-flavor name of the variant. This does not include the build type. If no flavors are present, this is an empty string. The full name of the variant is queried via[getName](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#getName()) <br /> | | [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.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)>> | [productFlavors](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/component/ComponentIdentity.html#productFlavors:kotlin.collections.List) <br /> List of flavor names, might be replaced with access to locked DSL objects once ready The order is properly sorted based on the associated dimension order <br />                                                                                       | ||

## Public methods

### addBuildConfigField

```
abstract fun addBuildConfigField(
    key: String, 
    value: Serializable, 
    comment: String?
): Unit
```

Convenience method to add a new Build Config field which value is known at configuration time.

|                                                                                                          Parameters                                                                                                          ||
|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| key:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)      | the build config field name                                                                                                       |
| value:[Serializable](http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html)  | the build config field value which type must be[Serializable](http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html) |
| comment:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | optional comment for the field.                                                                                                   |

### addResValue

```
abstract fun addResValue(
    name: String, 
    type: String, 
    value: String, 
    comment: String?
): Unit
```

Adds a ResValue element to the generated resources.

|                                                                              Parameters                                                                               ||
|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|
| name:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)     | the resource name                                                          |
| type:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)     | the resource type like 'string'                                            |
| value:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)    | the resource value                                                         |
| comment:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)? | optional comment to be added to the generated resource file for the field. |

### addResValue

```
abstract fun addResValue(
    name: String, 
    type: String, 
    value: Provider<String>, 
    comment: String?
): Unit
```

Adds a ResValue element to the generated resources.

|                                                                                                                                          Parameters                                                                                                                                          ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|
| name:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                               | the resource name                                                                                       |
| type:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                               | the resource type like 'string'                                                                         |
| value:[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)\> | a[Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)for the value |
| comment:[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?                                                                                           | optional comment to be added to the generated resource file for the field.                              |

## Properties

### applicationId

```
abstract val applicationId: Provider<String>
```

Variant's application ID as present in the final manifest file of the APK.

Some type of variants allows this to be writeable but for some it's only read-only.  

### buildConfigFields

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

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

### 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) ||

### packageName

```
abstract val packageName: Provider<String>
```

The package name into which some classes are generated