Android 12 Developer Preview is here! Try it out, and give us your feedback!

VariantExtensionConfig

@Incubating interface VariantExtensionConfig<VariantT : Variant>
com.android.build.api.extension.VariantExtensionConfig

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.

Summary

Public methods

abstract T
buildTypeExtension(extensionType: Class<T>)

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

abstract List<T>
productFlavorsExtensions(extensionType: Class<T>)

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

abstract T
projectExtension(extensionType: Class<T>)

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

Properties

abstract VariantT

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

Public methods

buildTypeExtension

abstract fun <T> buildTypeExtension(extensionType: Class<T>): T

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

Return
the custom extension for the variant's build type.

productFlavorsExtensions

abstract fun <T> productFlavorsExtensions(extensionType: Class<T>): List<T>

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

Return
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

abstract fun <T> projectExtension(extensionType: Class<T>): T

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

Properties

variant

abstract val variant: VariantT

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