ApplicationVariant

Added in 4.2.0

interface ApplicationVariant : GeneratesApk, Variant, HasDeviceTests, HasAndroidTest, HasHostTests, HasUnitTest, HasTestFixtures, CanMinifyCode, CanMinifyAndroidResources


Model for application components that only contains build-time properties.

See Component and Variant for more information.

Summary

Public properties

ApplicationAndroidResources

Variant's android resources processing configuration, initialized by the corresponding global DSL element.

Property<String>

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

BundleConfig

Variant's information related to the bundle creation configuration.

DependenciesInfo

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

ApkOutputProviders

Provides access to built artifacts output(e.g. APK) produced by this Variant.

List<VariantOutput>

Returns the final list of variant outputs.

TestedApkPackaging

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

SigningConfig

Variant's signingConfig, initialized by the corresponding DSL element.

Inherited functions

From com.android.build.api.variant.Component
String
@Incubating
computeTaskName(action: String, subject: String)

Utility method to create unique task name for component.

Unit

This function is deprecated. Will be removed in v9.0, use the instrumentation block.

Unit
<ParamT : InstrumentationParameters> transformClassesWith(
    classVisitorFactoryImplClass: Class<AsmClassVisitorFactory<ParamT>>,
    scope: InstrumentationScope,
    instrumentationParamsConfig: (ParamT) -> Unit
)

This function is deprecated. Will be removed in v9.0, use the instrumentation block.

From com.android.build.api.variant.HasAndroidResources
ResValue.Key
makeResValueKey(type: String, name: String)

Make a ResValue.Key to interact with resValues's MapProperty

From com.android.build.api.variant.Variant
T?
<T : Any?> getExtension(type: Class<T>)

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

Unit
@Incubating
missingDimensionStrategy(
    dimension: String,
    vararg requestedValues: String
)

Set up a new matching request for a given flavor dimension and value.

Inherited properties

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

Specifies whether resources will be shrinked.

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

Specifies whether code will be minified.

From com.android.build.api.variant.Component
Configuration

Access to the variant's annotation processor Configuration; for example, the debugAnnotationProcessor Configuration for the debug variant.

Artifacts

Access to the variant's buildable artifacts for build customization.

FileCollection

Access to the variant's compile classpath.

Configuration

Access to the variant's compile Configuration; for example, the debugCompileClasspath Configuration for the debug variant.

Boolean

Whether the produced artifacts will be debuggable

Instrumentation

Access to the variant's instrumentation options.

JavaCompilation

Access to the variant's java compilation options.

LifecycleTasks

Provides access to the LifecycleTasks created for this component.

Provider<String>

The namespace of the generated R and BuildConfig classes.

Configuration

Access to the variant's runtime Configuration; for example, the debugRuntimeClasspath Configuration for the debug variant.

Sources

Access to variant's source files.

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.GeneratesApk
Dexing

Variant's specific dexing options

AndroidVersion

Min SDK version for this variant

Renderscript?

Variant specific settings for the renderscript compiler.

AndroidVersion

Target SDK version for this variant.

AndroidVersion

This property is deprecated. Replaced with targetSdk, will be removed in 9.0

From com.android.build.api.variant.HasAndroidResources
Property<Boolean>

Variant's is pseudo locales enabled, initialized by the corresponding DSL elements.

MapProperty<ResValue.KeyResValue>

Variant's ResValue which will be generated.

From com.android.build.api.variant.HasAndroidTest
AndroidTest?

Variant's AndroidTest configuration, or null if android tests are disabled for this variant.

From com.android.build.api.variant.HasDeviceTests
Map<StringDeviceTest>

Variant's Map of DeviceTest configurations, or empty if all devices tests (like android tests) are disabled for this variant.

From com.android.build.api.variant.HasHostTests
Map<StringHostTest>

Map of Variant's HostTest, or empty if all host tests (like unit test) for this variant are disabled.

From com.android.build.api.variant.HasTestFixtures
TestFixtures?

Variant's TestFixtures, or null if the test fixtures for this variant are disabled.

From com.android.build.api.variant.Variant
MapProperty<StringBuildConfigField<Serializable>>

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

List<Component>

List containing this variant and all of its nestedComponents

MapProperty<StringAny>

Additional per variant experimental properties.

ExternalNativeBuild?

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

MapProperty<StringString>

MapProperty of the variant's manifest placeholders.

Int?

Gets the maximum supported SDK Version for this variant.

Int?
AndroidVersion
List<Component>

List of the components nested in this variant, the returned list will contain:

ListProperty<RegularFile>

List of proguard configuration files for this variant.

UnitTest?

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

Public properties

androidResources

Added in 8.8.0-alpha08
val androidResourcesApplicationAndroidResources

Variant's android resources processing configuration, initialized by the corresponding global DSL element.

applicationId

Added in 8.8.0-alpha08
val applicationIdProperty<String>

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

Setting this value will override anything set via the DSL with com.android.build.api.dsl.ApplicationBaseFlavor.applicationId, and com.android.build.api.dsl.ApplicationVariantDimension.applicationIdSuffix

bundleConfig

Added in 7.1.0
val bundleConfigBundleConfig

Variant's information related to the bundle creation configuration.

Returns
BundleConfig

Variant's BundleConfig.

dependenciesInfo

Added in 4.2.0
val dependenciesInfoDependenciesInfo

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

outputProviders

Added in 8.8.0-alpha08
val outputProvidersApkOutputProviders

Provides access to built artifacts output(e.g. APK) produced by this Variant.

outputs

Added in 4.2.0
val outputsList<VariantOutput>

Returns the final list of variant outputs.

Returns
List<VariantOutput>

read only list of VariantOutput for this variant.

packaging

Added in 8.8.0-alpha08
val packagingTestedApkPackaging

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

signingConfig

Added in 4.2.0
val signingConfigSigningConfig

Variant's signingConfig, initialized by the corresponding DSL element.

Returns
SigningConfig

Variant's config or null if the variant is not configured for signing.