ApplicationVariant

public interface ApplicationVariant extends GeneratesApk, Variant, HasAndroidTest, HasUnitTest, HasTestFixtures, CanMinifyCode, CanMinifyAndroidResources


Properties for the main Variant of an application.

Summary

Public methods

abstract @NonNull Property<@NonNull String>

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

abstract @NonNull BundleConfig

Variant's information related to the bundle creation configuration.

abstract @NonNull DependenciesInfo

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

abstract @NonNull List<@NonNull VariantOutput>

Returns the final list of variant outputs.

abstract @NonNull SigningConfig

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

Inherited methods

From com.android.build.api.variant.CanMinifyAndroidResources
abstract boolean

Specifies whether resources will be shrinked.

From com.android.build.api.variant.CanMinifyCode
abstract boolean

Specifies whether code will be minified.

From com.android.build.api.variant.Component
abstract @NonNull Configuration

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

abstract @NonNull Artifacts

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

abstract @NonNull FileCollection

Access to the variant's compile classpath.

abstract @NonNull Configuration

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

abstract @NonNull Instrumentation

Access to the variant's instrumentation options.

abstract @NonNull JavaCompilation

Access to the variant's java compilation options.

abstract @NonNull Provider<@NonNull String>

The namespace of the generated R and BuildConfig classes.

abstract @NonNull Configuration

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

abstract @NonNull Sources

Access to variant's source files.

abstract void

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

abstract void
<ParamT extends InstrumentationParameters> transformClassesWith(
    @NonNull Class<@NonNull AsmClassVisitorFactory<@NonNull ParamT>> classVisitorFactoryImplClass,
    @NonNull InstrumentationScope scope,
    @NonNull Function1<@NonNull ParamT, Unit> instrumentationParamsConfig
)

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

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

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

abstract String

The multi-flavor name of the variant.

abstract @NonNull String

Component's name.

abstract @NonNull List<@NonNull Pair<@NonNull String, @NonNull String>>

List of flavor names, might be replaced with access to locked DSL objects once ready.

From com.android.build.api.variant.GeneratesApk
abstract @NonNull AndroidResources

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

abstract @NonNull ApkPackaging

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

abstract Renderscript

Variant specific settings for the renderscript compiler.

abstract @NonNull AndroidVersion

Target SDK version for this variant.

abstract @NonNull AndroidVersion
From com.android.build.api.variant.HasAndroidResources
abstract @NonNull Property<@NonNull Boolean>

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

abstract @NonNull MapProperty<@NonNull ResValue.Key, @NonNull ResValue>

Variant's ResValue which will be generated.

abstract @NonNull ResValue.Key

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

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

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

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

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

From com.android.build.api.variant.Variant
abstract @NonNull MapProperty<@NonNull String, @NonNull BuildConfigField<@NonNull Serializable>>

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

abstract @NonNull List<@NonNull Component>

List containing this variant and all of its nestedComponents

abstract @NonNull MapProperty<@NonNull String, @NonNull Object>

Additional per variant experimental properties.

abstract T
<T extends Object> getExtension(@NonNull Class<@NonNull T> type)

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

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 @NonNull MapProperty<@NonNull String, @NonNull String>

MapProperty of the variant's manifest placeholders.

abstract Integer

Gets the maximum supported SDK Version for this variant.

abstract Integer
abstract @NonNull AndroidVersion

Gets the minimum supported SDK Version for this variant.

abstract @NonNull AndroidVersion
abstract @NonNull List<@NonNull Component>

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

abstract @NonNull ListProperty<@NonNull RegularFile>

List of proguard configuration files for this variant.

abstract UnitTest

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

abstract void
@Incubating
missingDimensionStrategy(
    @NonNull String dimension,
    @NonNull String requestedValues
)

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

Public methods

getApplicationId

abstract @NonNull Property<@NonNull StringgetApplicationId()

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

getBundleConfig

@Incubating
abstract @NonNull BundleConfig getBundleConfig()

Variant's information related to the bundle creation configuration.

Returns
@NonNull BundleConfig

Variant's BundleConfig.

getDependenciesInfo

abstract @NonNull DependenciesInfo getDependenciesInfo()

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

getOutputs

abstract @NonNull List<@NonNull VariantOutputgetOutputs()

Returns the final list of variant outputs.

Returns
@NonNull List<@NonNull VariantOutput>

read only list of VariantOutput for this variant.

getSigningConfig

abstract @NonNull SigningConfig getSigningConfig()

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

Returns
@NonNull SigningConfig

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