Variant

interface Variant : Component, HasAndroidResources
com.android.build.api.variant.Variant

Parent interface for all types of variants.

Summary

Public methods

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

Returns an extension object registered via the VariantBuilder.registerExtension API or null if none were registered under the passed type.

Inherited functions

Properties

abstract MapProperty<String, BuildConfigField<out Serializable>>

Variant's BuildConfigField which will be generated in the BuildConfig class.

abstract MapProperty<String, Any>

Additional per variant experimental properties.

abstract ExternalNativeBuild?

Variant's cmake ExternalNativeBuild, initialized by merging the product flavor values or null if no cmake external build is configured for this variant.

abstract MapProperty<String, String>

MapProperty of the variant's manifest placeholders.

abstract Int?

Gets the maximum supported SDK Version for this variant.

abstract AndroidVersion

Gets the minimum supported SDK Version for this variant.

abstract Provider<String>

The namespace of the generated R and BuildConfig classes.

abstract Packaging

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

abstract ListProperty<RegularFile>

List of proguard configuration files for this variant.

abstract AndroidVersion

Gets the target SDK Version for this variant.

abstract UnitTest?

Variant's UnitTest, or null if the unit tests for this variant are disabled.

Inherited properties

Public methods

getExtension

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

Returns an extension object registered via the VariantBuilder.registerExtension API or null if none were registered under the passed type.

Return
the registered object or null.

Properties

buildConfigFields

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

Variant's 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

externalNativeBuild

abstract val externalNativeBuild: ExternalNativeBuild?

Variant's cmake 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 of the variant's manifest placeholders.

Placeholders are organized with a key and a value. The value is a String that will be used as is in the merged manifest.

Return
the MapProperty with keys as String

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 for non test related variants and from com.android.build.api.dsl.VariantDimension.testProguardFiles 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, or null if the unit tests for this variant are disabled.