From class VariantDimension
Unit |
addManifestPlaceholders(manifestPlaceholders: Map<String, Any>)
Adds manifest placeholders.
See
Inject Build Variables into the Manifest.
|
Unit |
addManifestPlaceholders(manifestPlaceholders: Map<String, Any>)
Adds manifest placeholders.
See
Inject Build Variables into the Manifest.
|
Unit |
buildConfigField(type: String, name: String, value: String)
Adds a new field to the generated BuildConfig class.
The field is generated as: <type> <name> = <value>;
This means each of these must have valid Java content. If the type is a String, then the
value should include quotes.
|
Unit |
buildConfigField(type: String, name: String, value: String)
Adds a new field to the generated BuildConfig class.
The field is generated as: <type> <name> = <value>;
This means each of these must have valid Java content. If the type is a String, then the
value should include quotes.
|
Unit |
externalNativeBuild(action: ExternalNativeBuildOptions.() -> Unit)
Encapsulates per-variant CMake and ndk-build configurations for your external native build.
To learn more, see
Add C and C++ Code to Your Project.
|
Unit |
externalNativeBuild(action: ExternalNativeBuildOptions.() -> Unit)
Encapsulates per-variant CMake and ndk-build configurations for your external native build.
To learn more, see
Add C and C++ Code to Your Project.
|
Unit |
javaCompileOptions(action: JavaCompileOptions.() -> Unit)
Options for configuring Java compilation.
|
Unit |
javaCompileOptions(action: JavaCompileOptions.() -> Unit)
Options for configuring Java compilation.
|
Unit |
ndk(action: Ndk.() -> Unit)
Encapsulates per-variant configurations for the NDK, such as ABI filters.
|
Unit |
ndk(action: Ndk.() -> Unit)
Encapsulates per-variant configurations for the NDK, such as ABI filters.
|
Any |
proguardFile(proguardFile: Any)
Adds a new ProGuard configuration file.
proguardFile getDefaultProguardFile('proguard-android.txt')
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Any |
proguardFile(proguardFile: Any)
Adds a new ProGuard configuration file.
proguardFile getDefaultProguardFile('proguard-android.txt')
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Any |
proguardFiles(vararg files: Any)
Adds new ProGuard configuration files.
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Any |
proguardFiles(vararg files: Any)
Adds new ProGuard configuration files.
There are two ProGuard rules files that ship with the Android plugin and are used by
default:
- proguard-android.txt
- proguard-android-optimize.txt
proguard-android-optimize.txt is identical to proguard-android.txt ,
except with optimizations enabled. You can use getDefaultProguardFileString
to return the full path of the files.
This method has a return value for legacy reasons.
|
Unit |
resValue(type: String, name: String, value: String)
Adds a new generated resource.
This is equivalent to specifying a resource in res/values.
See Resource Types.
|
Unit |
resValue(type: String, name: String, value: String)
Adds a new generated resource.
This is equivalent to specifying a resource in res/values.
See Resource Types.
|
Void? |
setManifestPlaceholders(manifestPlaceholders: Map<String, Any>)
|
Void? |
setManifestPlaceholders(manifestPlaceholders: Map<String, Any>)
|
Any |
setProguardFiles(proguardFileIterable: Iterable<*>)
Replaces the ProGuard configuration files.
This method has a return value for legacy reasons.
|
Any |
setProguardFiles(proguardFileIterable: Iterable<*>)
Replaces the ProGuard configuration files.
This method has a return value for legacy reasons.
|
Unit |
shaders(action: Shaders.() -> Unit)
Configure the shader compiler options.
|
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.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
Any |
testProguardFile(proguardFile: Any)
Adds a proguard rule file to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
Any |
testProguardFiles(vararg proguardFiles: Any)
Adds proguard rule files to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
Any |
testProguardFiles(vararg proguardFiles: Any)
Adds proguard rule files to be used when processing test code.
Test code needs to be processed to apply the same obfuscation as was done to main code.
This method has a return value for legacy reasons.
|
|
From class BaseFlavor
String |
getName()
The name of the flavor.
|
Unit |
initWith(that: BaseFlavor)
Copies all properties from the given flavor.
It can be used like this:
android.productFlavors {
paid {
initWith free
// customize...
}
}
|
Unit |
minSdkVersion(minSdkVersion: Int)
|
Unit |
minSdkVersion(minSdkVersion: String?)
|
Unit |
missingDimensionStrategy(dimension: String, requestedValue: String)
Specifies a flavor that the plugin should try to use from a given dimension in a dependency.
Android plugin 3.0.0 and higher try to match each variant of your module with the same one
from its dependencies. For example, consider if both your app and its dependencies include a
"tier" flavor dimension,
with flavors "free" and "paid". When you build a "freeDebug" version of your app, the plugin
tries to match it with "freeDebug" versions of the local library modules the app depends on.
However, there may be situations in which a library dependency includes a flavordimension that your app does not. For example, consider if a library dependency includes
flavors for a "minApi" dimension, but your app includes flavors for only the "tier"
dimension. So, when you want to build the "freeDebug" version of your app, the plugin doesn't
know whether to use the "minApi23Debug" or "minApi18Debug" version of the dependency, and
you'll see an error message similar to the following:
Error:Failed to resolve: Could not resolve project :mylibrary.
Required by:
project :app
In this type of situation, use missingDimensionStrategy in the
defaultConfig
block to specify the default flavor the plugin should select from each missing
dimension, as shown in the sample below. You can also override your selection in the
productFlavors
block, so each flavor can specify a different matching strategy for a missing dimension.
(Tip: you can also use this property if you simply want to change the matching strategy for a
dimension that exists in both the app and its dependencies.)
// In the app's build.gradle file.
android {
defaultConfig {
// Specifies a flavor that the plugin should try to use from
// a given dimension. The following tells the plugin that, when encountering
// a dependency that includes a "minApi" dimension, it should select the
// "minApi18" flavor.
missingDimensionStrategy 'minApi', 'minApi18'
// You should specify a missingDimensionStrategy property for each
// dimension that exists in a local dependency but not in your app.
missingDimensionStrategy 'abi', 'x86'
}
flavorDimensions 'tier'
productFlavors {
free {
dimension 'tier'
// You can override the default selection at the product flavor
// level by configuring another missingDimensionStrategy property
// for the "minApi" dimension.
missingDimensionStrategy 'minApi', 'minApi23'
}
paid { }
}
}
|
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.
Android plugin 3.0.0 and higher try to match each variant of your module with the same one
from its dependencies. For example, consider if both your app and its dependencies include a
"tier" flavor dimension,
with flavors "free" and "paid". When you build a "freeDebug" version of your app, the plugin
tries to match it with "freeDebug" versions of the local library modules the app depends on.
However, there may be situations in which a library dependency includes a flavordimension that your app does not. For example, consider if a library dependency includes
flavors for a "minApi" dimension, but your app includes flavors for only the "tier"
dimension. So, when you want to build the "freeDebug" version of your app, the plugin doesn't
know whether to use the "minApi23Debug" or "minApi18Debug" version of the dependency, and
you'll see an error message similar to the following:
Error:Failed to resolve: Could not resolve project :mylibrary.
Required by:
project :app
In this type of situation, use missingDimensionStrategy in the
defaultConfig
block to specify the default flavor the plugin should select from each missing
dimension, as shown in the sample below. You can also override your selection in the
productFlavors
block, so each flavor can specify a different matching strategy for a missing dimension.
(Tip: you can also use this property if you simply want to change the matching strategy for a
dimension that exists in both the app and its dependencies.)
// In the app's build.gradle file.
android {
defaultConfig {
// Specifies a flavor that the plugin should try to use from
// a given dimension. The following tells the plugin that, when encountering
// a dependency that includes a "minApi" dimension, it should select the
// "minApi18" flavor.
missingDimensionStrategy 'minApi', 'minApi18'
// You should specify a missingDimensionStrategy property for each
// dimension that exists in a local dependency but not in your app.
missingDimensionStrategy 'abi', 'x86'
}
flavorDimensions 'tier'
productFlavors {
free {
dimension 'tier'
// You can override the default selection at the product flavor
// level by configuring another missingDimensionStrategy property
// for the "minApi" dimension.
missingDimensionStrategy 'minApi', 'minApi23'
}
paid { }
}
}
|
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.
Android plugin 3.0.0 and higher try to match each variant of your module with the same one
from its dependencies. For example, consider if both your app and its dependencies include a
"tier" flavor dimension,
with flavors "free" and "paid". When you build a "freeDebug" version of your app, the plugin
tries to match it with "freeDebug" versions of the local library modules the app depends on.
However, there may be situations in which a library dependency includes a flavordimension that your app does not. For example, consider if a library dependency includes
flavors for a "minApi" dimension, but your app includes flavors for only the "tier"
dimension. So, when you want to build the "freeDebug" version of your app, the plugin doesn't
know whether to use the "minApi23Debug" or "minApi18Debug" version of the dependency, and
you'll see an error message similar to the following:
Error:Failed to resolve: Could not resolve project :mylibrary.
Required by:
project :app
In this type of situation, use missingDimensionStrategy in the
defaultConfig
block to specify the default flavor the plugin should select from each missing
dimension, as shown in the sample below. You can also override your selection in the
productFlavors
block, so each flavor can specify a different matching strategy for a missing dimension.
(Tip: you can also use this property if you simply want to change the matching strategy for a
dimension that exists in both the app and its dependencies.)
// In the app's build.gradle file.
android {
defaultConfig {
// Specifies a flavor that the plugin should try to use from
// a given dimension. The following tells the plugin that, when encountering
// a dependency that includes a "minApi" dimension, it should select the
// "minApi18" flavor.
missingDimensionStrategy 'minApi', 'minApi18'
// You should specify a missingDimensionStrategy property for each
// dimension that exists in a local dependency but not in your app.
missingDimensionStrategy 'abi', 'x86'
}
flavorDimensions 'tier'
productFlavors {
free {
dimension 'tier'
// You can override the default selection at the product flavor
// level by configuring another missingDimensionStrategy property
// for the "minApi" dimension.
missingDimensionStrategy 'minApi', 'minApi23'
}
paid { }
}
}
|
Unit |
resConfig(config: String)
|
Unit |
resConfigs(config: Collection<String>)
|
Unit |
resConfigs(vararg config: String)
|
Unit |
setMinSdkVersion(minSdkVersion: Int)
|
Unit |
setMinSdkVersion(minSdkVersion: String?)
|
Any? |
setTestFunctionalTest(testFunctionalTest: Boolean)
|
Any? |
setTestHandleProfiling(testHandleProfiling: Boolean)
|
Any? |
setTestInstrumentationRunnerArguments(testInstrumentationRunnerArguments: MutableMap<String, String>)
|
Unit |
testInstrumentationRunnerArgument(key: String, value: String)
|
Unit |
testInstrumentationRunnerArguments(args: Map<String, String>)
|
Unit |
vectorDrawables(action: VectorDrawables.() -> Unit)
Configures VectorDrawables.
|
|