VariantBuilder
interface VariantBuilder : ComponentBuilder
ApplicationVariantBuilder |
Application specific variant object that contains properties that will determine the variant's build flow. |
DynamicFeatureVariantBuilder |
|
LibraryVariantBuilder |
|
TestVariantBuilder |
|
Variant object that contains properties that must be set during configuration time as it changes the build flow for the variant.
Summary
Public functions |
|
---|---|
Unit |
<T : Any> registerExtension(type: Class<T>, instance: T) Registers an extension object to the variant object. |
Public properties |
|
---|---|
Boolean |
Set to |
Int? |
Gets the maximum supported SDK Version for this variant. |
Int? |
Gets or sets the minimum supported SDK Version for this variant. |
String? |
Gets or 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 |
String? |
This property is deprecated. Will be removed in v9.0 |
Boolean |
This property is deprecated. Use enableUnitTest |
Inherited properties |
|
---|---|
Public functions
registerExtension
fun <T : Any> registerExtension(type: Class<T>, instance: T): Unit
Registers an extension object to the variant object. Extension objects can be looked up during the AndroidComponentsExtension.onVariants
callbacks by using the Variant.getExtension
API.
This is very useful for third party plugins that want to attach some variant specific configuration object to the Android Gradle Plugin variant object and make it available to other plugins.
Parameters | |
---|---|
type: Class<T> |
the registered object type (can be a supertype of |
instance: T |
the object to associate to the AGP Variant object. |
Public properties
enableUnitTest
var enableUnitTest: Boolean
Set to true
if the variant's has any unit tests, false otherwise. Value is Boolean#True by default.
minSdk
var minSdk: Int?
Gets or sets the minimum supported SDK Version for this variant. Setting this it will override previous calls of minSdk
and minSdkPreview
setters. Only one of minSdk
and minSdkPreview
should be set.
Returns | |
---|---|
Int? |
the minimum supported SDK Version or null if |
minSdkPreview
var minSdkPreview: String?
Gets or sets the minimum supported SDK Version for this variant as a Preview codename. Setting this it will override previous calls of minSdk
and minSdkPreview
setters. Only one of minSdk
and minSdkPreview
should be set.
renderscriptTargetApi
var renderscriptTargetApi: Int
Specifies the bytecode version to be generated. We recommend you set this value to the lowest API level able to provide all the functionality you are using
Returns | |
---|---|
Int |
the renderscript target api or -1 if not specified. |
targetSdk
var targetSdk: Int?
Gets or sets the target SDK Version for this variant as a Preview codename. Setting this it will override previous calls of targetSdk
and targetSdkPreview
setters. Only one of targetSdk
and targetSdkPreview
should be set.
targetSdk is now managed by GeneratesApkBuilder
instead of VariantBuilder
.
Returns | |
---|---|
Int? |
the target SDK Version or null if |
targetSdkPreview
var targetSdkPreview: String?
Gets or sets the target SDK Version for this variant as a Preview codename. Setting this it will override previous calls of targetSdk
and targetSdkPreview
setters. Only one of targetSdk
and targetSdkPreview
should be set.
targetSdkPreview is now managed by GeneratesApkBuilder
instead of VariantBuilder
.
Returns | |
---|---|
String? |
the target supported SDK Version or null if |
unitTestEnabled
var unitTestEnabled: Boolean
Set to true
if the variant's has any unit tests, false otherwise. Value is Boolean#True by default.