ApplicationProductFlavor

Added in 4.2.0

interface ApplicationProductFlavor : ApplicationBaseFlavor, ProductFlavor


Encapsulates all product flavors properties for application projects.

Product flavors represent different versions of your project that you expect to co-exist on a single device, the Google Play store, or repository. For example, you can configure 'demo' and 'full' product flavors for your app, and each of those flavors can specify different features, device requirements, resources, and application ID's--while sharing common source code and resources. So, product flavors allow you to output different versions of your project by simply changing only the components and settings that are different between them.

Configuring product flavors is similar to configuring build types: add them to the productFlavors block of your project's build.gradle file and configure the settings you want.

Product flavors support the same properties as the DefaultConfig block—this is because defaultConfig defines a ProductFlavor object that the plugin uses as the base configuration for all other flavors. Each flavor you configure can then override any of the default values in defaultConfig, such as the applicationId.

When using Android plugin 3.0.0 and higher, each flavor must belong to a dimension.

When you configure product flavors, the Android plugin automatically combines them with your BuildType configurations to create build variants. If the plugin creates certain build variants that you don't want, you can filter variants using android.variantFilter.

Summary

Public properties

Boolean

Whether this product flavor should be selected in Studio by default

Inherited functions

From com.android.build.api.dsl.ApplicationBaseFlavor
Unit
maxSdkVersion(maxSdkVersion: Int)

This function is deprecated. Replaced by maxSdk property

Unit
setTargetSdkVersion(targetSdkVersion: String?)

This function is deprecated. Replaced by targetSdkPreview property

Unit
targetSdkVersion(targetSdkVersion: Int)

This function is deprecated. Replaced by targetSdk property

Unit
targetSdkVersion(targetSdkVersion: String?)

This function is deprecated. Replaced by targetSdkPreview property

From com.android.build.api.dsl.BaseFlavor
String

The name of the flavor.

Unit

Copies all properties from the given flavor.

Unit
minSdkVersion(minSdkVersion: Int)

This function is deprecated. Replaced by minSdk property

Unit
minSdkVersion(minSdkVersion: String?)

This function is deprecated. Replaced by minSdkPreview property

Unit
missingDimensionStrategy(dimension: String, requestedValue: String)

Specifies a flavor that the plugin should try to use from a given dimension in a dependency.

Unit
missingDimensionStrategy(
    dimension: String,
    requestedValues: List<String>
)

Specifies a sorted list of flavors that the plugin should try to use from a given dimension in a dependency.

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

Specifies a sorted list of flavors that the plugin should try to use from a given dimension in a dependency.

Unit
resConfig(config: String)

This function is deprecated. Replaced by resourceConfigurations field

Unit

This function is deprecated. Replaced by resourceConfigurations field

Unit
resConfigs(vararg config: String)

This function is deprecated. Replaced by resourceConfigurations field

Unit
setMinSdkVersion(minSdkVersion: Int)

This function is deprecated. Replaced by minSdk property

Unit
setMinSdkVersion(minSdkVersion: String?)

This function is deprecated. Replaced by minSdkPreview property

Any?
setTestFunctionalTest(testFunctionalTest: Boolean)

This function is deprecated. Replaced by testFunctionalTest property

Any?
setTestHandleProfiling(testHandleProfiling: Boolean)

This function is deprecated. Replaced by testFunctionalTest property

Any?
setTestInstrumentationRunnerArguments(
    testInstrumentationRunnerArguments: MutableMap<StringString>
)

This function is deprecated. Replaced by testInstrumentationRunnerArguments property

Unit

This function is deprecated. Replaced by testInstrumentationRunnerArguments property

Unit

This function is deprecated. Replaced by testInstrumentationRunnerArguments property

Unit

Configures VectorDrawables.

From org.gradle.api.plugins.ExtensionAware
From com.android.build.api.dsl.ProductFlavor
Void?
setDimension(dimension: String?)

This function is deprecated. Replaced with the dimension property

Unit

This function is deprecated. Replaced with property matchingFallbacks

Unit
setMatchingFallbacks(vararg fallbacks: String)

This function is deprecated. Replaced with property matchingFallbacks

From com.android.build.api.dsl.VariantDimension
Unit
addManifestPlaceholders(manifestPlaceholders: Map<StringAny>)

Adds manifest placeholders.

Unit
buildConfigField(type: String, name: String, value: String)

Adds a new field to the generated BuildConfig class.

Unit

Encapsulates per-variant CMake and ndk-build configurations for your external native build.

Unit

Options for configuring Java compilation.

Unit
ndk(action: Ndk.() -> Unit)

Encapsulates per-variant configurations for the NDK, such as ABI filters.

Unit
Any
proguardFile(proguardFile: Any)

Adds a new ProGuard configuration file.

Any
proguardFiles(vararg files: Any)

Adds new ProGuard configuration files.

Unit
resValue(type: String, name: String, value: String)

Adds a new generated resource.

Void?
setManifestPlaceholders(manifestPlaceholders: Map<StringAny>)

This function is deprecated. Use manifestPlaceholders property instead

Any
setProguardFiles(proguardFileIterable: Iterable<*>)

Replaces the ProGuard configuration files.

Unit
shaders(action: Shaders.() -> Unit)

Configure the shader compiler options.

Any
testProguardFile(proguardFile: Any)

Adds a proguard rule file to be used when processing test code.

Any
testProguardFiles(vararg proguardFiles: Any)

Adds proguard rule files to be used when processing test code.

Inherited properties

From com.android.build.api.dsl.ApplicationBaseFlavor
String?

The application ID.

Int?

The maxSdkVersion, or null if not specified.

Int?

The target SDK version.

String?

The target SDK version.

Int?

Version code.

String?

Version name.

From com.android.build.api.dsl.ApplicationVariantDimension
String?

Application id suffix.

Boolean?

Returns whether multi-dex is enabled.

ApkSigningConfig?

The associated signing config or null if none are set on the variant dimension.

String?

Version name suffix.

From com.android.build.api.dsl.BaseFlavor
Int?

The minimum SDK version.

String?

The minimum SDK version.

Boolean?

Whether the renderscript code should be compiled to generate C/C++ bindings.

Boolean?

Whether the renderscript BLAS support lib should be used to make it compatible with older versions of Android.

Boolean?

Whether the renderscript code should be compiled in support mode to make it compatible with older versions of Android.

Int?

The renderscript target api, or null if not specified.

MutableSet<String>

Specifies a list of alternative resources to keep.

String?

Test application ID.

Boolean?

See instrumentation.

Boolean?

See instrumentation.

String?

Test instrumentation runner class name.

MutableMap<StringString>

Test instrumentation runner custom arguments.

VectorDrawables

Options to configure the build-time support for vector drawables.

Boolean?

Whether to enable unbundling mode for embedded wear app.

From com.android.build.api.dsl.ProductFlavor
String?

Specifies the flavor dimension that this product flavor belongs to.

MutableList<String>

Specifies a sorted list of product flavors that the plugin should try to use when a direct variant match with a local module dependency is not possible.

From com.android.build.api.dsl.VariantDimension
ExternalNativeBuildFlags

Encapsulates per-variant CMake and ndk-build configurations for your external native build.

JavaCompileOptions

Options for configuring Java compilation.

MutableMap<StringAny>

The manifest placeholders.

File?

This property is deprecated. This property is deprecated.

File?

Text file with additional ProGuard rules to be used to determine which classes are compiled into the main dex file.

Ndk

Encapsulates per-variant configurations for the NDK, such as ABI filters.

Optimization
MutableList<File>

Specifies the ProGuard configuration files that the plugin should use.

Shaders

Options for configuring the shader compiler.

MutableList<File>

The collection of proguard rule files to be used when processing test code.

Public properties

isDefault

Added in 4.2.0
var isDefaultBoolean

Whether this product flavor should be selected in Studio by default