ApplicationVariantBuilder

interface ApplicationVariantBuilder : VariantBuilder, HasAndroidTestBuilder, HasTestFixturesBuilder

Application specific variant object that contains properties that will determine the variant's build flow.

For example, an application variant may have minification on or off, or have a different minSdkVersion from the other variants.

All these properties must be resolved during configuration time as org.gradle.api.Task representing the variant build flows must be created.

Summary

Inherited functions

Unit registerExtension(type: Class<out T>, instance: T)

Registers an extension object to the variant object. Extension objects can be looked up during the AndroidComponentsExtension.onVariants callbacks by using the Variant.getExtension API.

This is very useful for third party plugins that want to attach some variant specific configuration object to the Android Gradle Plugin variant object and make it available to other plugins.

Properties

abstract Boolean

abstract DependenciesInfoBuilder

Specify whether to include SDK dependency information in APKs and Bundles.

Inherited properties

Boolean androidTestEnabled

Set to true if the variant's has any android tests, false otherwise. Value is Boolean#True by default.

Boolean enableAndroidTest

Set to true if the variant's has any android tests, false otherwise. Value is Boolean#True by default.

String? buildType

Build type name, might be replaced with access to locked DSL object once ready.

String? flavorName

The multi-flavor name of the variant.

This does not include the build type. If no flavors are present, this will return null

The full name of the variant is queried via name.

String name

Component's name.

List<Pair<String, String>> productFlavors

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.

Boolean enable

Set to true if the variant is active and should be configured, false otherwise.

Boolean enabled

Boolean enableTestFixtures

Set to true if the variant's has test fixtures, false otherwise.

Default value will match com.android.build.api.dsl.TestFixtures.enable value that is set through the extension via com.android.build.api.dsl.TestedExtension.testFixtures.

Boolean enableUnitTest

Set to true if the variant's has any unit tests, false otherwise. Value is Boolean#True by default.

Int? maxSdk

Gets the maximum supported SDK Version for this variant.

Int? minSdk

Gets or sets the minimum supported SDK Version for this variant. Setting this it will override previous calls of minSdk and minSdkPreview setters. Only one of minSdk and minSdkPreview should be set.

String? minSdkPreview

Gets or sets the minimum supported SDK Version for this variant as a Preview codename. Setting this it will override previous calls of minSdk and minSdkPreview setters. Only one of minSdk and minSdkPreview should be set.

Int renderscriptTargetApi

Specifies the bytecode version to be generated. We recommend you set this value to the lowest API level able to provide all the functionality you are using

Int? targetSdk

Gets or sets the target SDK Version for this variant as a Preview codename. Setting this it will override previous calls of targetSdk and targetSdkPreview setters. Only one of targetSdk and targetSdkPreview should be set.

String? targetSdkPreview

Gets or sets the target SDK Version for this variant as a Preview codename. Setting this it will override previous calls of targetSdk and targetSdkPreview setters. Only one of targetSdk and targetSdkPreview should be set.

Boolean unitTestEnabled

Set to true if the variant's has any unit tests, false otherwise. Value is Boolean#True by default.

Properties

debuggable

abstract val debuggable: Boolean

dependenciesInfo

abstract val dependenciesInfo: DependenciesInfoBuilder

Specify whether to include SDK dependency information in APKs and Bundles.