ApplicationVariantBuilder

Added in 4.2.0

interface ApplicationVariantBuilder : VariantBuilder, HasDeviceTestsBuilder, HasAndroidTestBuilder, HasHostTestsBuilder, HasUnitTestBuilder, HasTestFixturesBuilder, GeneratesApkBuilder, CanMinifyCodeBuilder, CanMinifyAndroidResourcesBuilder


Model for application components that only contains configuration-time properties that impacts the build flow.

See ComponentBuilder and VariantBuilder for more information.

Summary

Public properties

ApplicationAndroidResourcesBuilder

Access all configuration-time android resources processing properties.

Boolean

Whether the variant is debuggable.

DependenciesInfoBuilder

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

Boolean

Set to true if the variant is profileable, false otherwise.

Inherited functions

From com.android.build.api.variant.VariantBuilder
Unit
<T : Any> registerExtension(type: Class<T>, instance: T)

Registers an extension object to the variant object.

Inherited properties

From com.android.build.api.variant.CanMinifyAndroidResourcesBuilder
Boolean

Specifies whether resources will be shrinked

From com.android.build.api.variant.CanMinifyCodeBuilder
Boolean

Specifies whether code will be minified

From com.android.build.api.variant.ComponentBuilder
Boolean

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

Boolean

This property is deprecated. Will be removed in 9.0

From com.android.build.api.variant.ComponentIdentity
String?

Build type name.

String?

The multi-flavor name of the variant.

String

Component's name.

List<Pair<StringString>>

List of flavor names.

From com.android.build.api.variant.GeneratesApkBuilder
Boolean?

Sets whether multi-dex is enabled for this variant.

From com.android.build.api.variant.HasAndroidTestBuilder
AndroidTestBuilder

Variant's AndroidTestBuilder configuration to turn on or off android tests and set other android test related settings.

Boolean

Set to true if the variant's has any android tests, false otherwise.

Boolean

Set to true if the variant's has any android tests, false otherwise.

From com.android.build.api.variant.HasDeviceTestsBuilder
From com.android.build.api.variant.HasHostTestsBuilder
Map<StringHostTestBuilder>

Variant's HostTestBuilder configuration to turn on or off screenshot tests and set other screenshot test related settings.

From com.android.build.api.variant.HasTestFixturesBuilder
Boolean

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

From com.android.build.api.variant.VariantBuilder
Boolean

This property is deprecated. Will be removed in AGP 9.0 - Use (variantBuilder as HasHostTestsBuilder).get(HasHostTestsBuilder.UNIT_TEST_TYPE).enable

Int?

Sets the maximum supported SDK Version for this variant.

Int?

Sets the minimum supported SDK Version for this variant.

String?

Sets the minimum supported SDK Version for this variant as a Preview codename.

Int

Specifies the bytecode version to be generated.

Int?

This property is deprecated. Will be removed in v9.0 - Use (variantBuilder as GeneratesApkBuilder).targetSdk

String?

This property is deprecated. Will be removed in v9.0 - Use (variantBuilder as GeneratesApkBuilder).targetSdkPreview

Boolean

This property is deprecated. Will be removed in AGP 9.0 - Use (variantBuilder as HasHostTestsBuilder).get(HasHostTestsBuilder.UNIT_TEST_TYPE).enable

Public properties

androidResources

Added in 8.4.0
val androidResourcesApplicationAndroidResourcesBuilder

Access all configuration-time android resources processing properties.

debuggable

Added in 4.2.0
val debuggableBoolean

Whether the variant is debuggable.

dependenciesInfo

Added in 4.2.0
val dependenciesInfoDependenciesInfoBuilder

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

profileable

Added in 8.3.1
Deprecated in 8.3.1
var profileableBoolean

Set to true if the variant is profileable, false otherwise. Default value is calculated based on options and DSL.

It is not safe to read the value of this property as other plugins that were applied later can change this value so there is no guarantee you would get the final value. To get the final value, use the AndroidComponentsExtension.onVariants API :

onVariants { variant ->
variant.profileable
}

Note the a RuntimeException will be thrown at Runtime if a java or groovy code tries to read the property value.