VariantExtensionConfig

@Incubating
public interface VariantExtensionConfig<VariantT extends 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 extends Variant>

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

Summary

Public methods

abstract @NonNull T
<T extends Object> buildTypeExtension(@NonNull Class<@NonNull T> extensionType)

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

abstract @NonNull VariantT

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

abstract @NonNull List<@NonNull T>
<T extends Object> productFlavorsExtensions(
    @NonNull Class<@NonNull T> extensionType
)

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

abstract @NonNull T
<T extends Object> projectExtension(@NonNull Class<@NonNull T> extensionType)

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

Public methods

buildTypeExtension

abstract @NonNull T <T extends Object> buildTypeExtension(@NonNull Class<@NonNull T> extensionType)

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

Returns
@NonNull T

the custom extension for the variant's build type.

getVariant

abstract @NonNull VariantT getVariant()

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

productFlavorsExtensions

abstract @NonNull List<@NonNull T> <T extends Object> productFlavorsExtensions(
    @NonNull Class<@NonNull T> extensionType
)

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

Returns
@NonNull List<@NonNull 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

abstract @NonNull T <T extends Object> projectExtension(@NonNull Class<@NonNull T> extensionType)

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