VariantExtensionConfig

Added in 7.0.0

@Incubating
interface VariantExtensionConfig<VariantT : Variant>


Configuration object passed to the lambda responsible for creating a com.android.build.api.variant.VariantExtension for each com.android.build.api.variant.Variant instance.

Parameters
<VariantT : Variant>

the type of com.android.build.api.variant.Variant object.

Summary

Public functions

T
<T : Any?> buildTypeExtension(extensionType: Class<T>)

Returns the variant specific extension registered through the com.android.build.api.extension.DslExtension.buildTypeExtensionType API.

List<T>
<T : Any?> productFlavorsExtensions(extensionType: Class<T>)

Returns the variant specific extension registered through the com.android.build.api.extension.DslExtension.productFlavorExtensionType API.

T
<T : Any?> projectExtension(extensionType: Class<T>)

Returns the project (across variants) extension registered through the com.android.build.api.extension.DslExtension.projectExtensionType API.

Public properties

VariantT

Gets the variant object the com.android.build.api.variant.VariantExtension should be associated with.

Public functions

buildTypeExtension

Added in 7.0.0
fun <T : Any?> buildTypeExtension(extensionType: Class<T>): T

Returns the variant specific extension registered through the com.android.build.api.extension.DslExtension.buildTypeExtensionType API.

Returns
T

the custom extension for the variant's build type.

productFlavorsExtensions

Added in 7.0.0
fun <T : Any?> productFlavorsExtensions(extensionType: Class<T>): List<T>

Returns the variant specific extension registered through the com.android.build.api.extension.DslExtension.productFlavorExtensionType API.

Returns
List<T>

a List of T extension for all the defined product flavors in the project. The order of the elements is the same as the order of product flavors returned by the Variant.productFlavors

projectExtension

Added in 7.0.0
fun <T : Any?> projectExtension(extensionType: Class<T>): T

Returns the project (across variants) extension registered through the com.android.build.api.extension.DslExtension.projectExtensionType API.

Public properties

variant

Added in 7.0.0
val variant: VariantT

Gets the variant object the com.android.build.api.variant.VariantExtension should be associated with.