ComponentBuilder

Added in 7.0.0

interface ComponentBuilder : ComponentIdentity

Known direct subclasses
VariantBuilder

Model for variant components that only contains configuration-time properties that impacts the build flow.

Known indirect subclasses
ApplicationVariantBuilder

Model for application components that only contains configuration-time properties that impacts the build flow.

DynamicFeatureVariantBuilder

Model for dynamic feature components that only contains configuration-time properties that impacts the build flow.

LibraryVariantBuilder

Model for library components that only contains configuration-time properties that impacts the build flow.

TestVariantBuilder

Model for test components that only contains configuration-time properties that impacts the build flow.


Model for components that only contains configuration-time properties that impacts the build flow.

Components can be APKs, AARs, test APKs, unit tests, test fixtures, ...

This is the parent interface for all objects that can be manipulated by AndroidComponentsExtension.beforeVariants

This type is here to mirror the Component/Variant hierarchy, which also includes TestComponent (which is not a Variant). In this hierarchy however, there isn't a TestComponentBuilder and therefore all objects of this type are also VariantBuilder

See VariantBuilder for more information on accessing instances of this type.

The properties exposed by this object have an impact on the build flow. They can add or remove tasks, and change how the tasks consume each other's output. Because of this, they are not using Gradle's org.gradle.api.provider.Property so that they can be queried during configuration. Because other applied plugins can change these values in their beforeVariants block, it is not safe to read these values in this stage.

This object should only be used to set new values. To read the final values of these properties, find the matching property in Component, and its subtypes

See here for more information

Summary

Public properties

Boolean

Set to true if the variant is active and should be configured, false otherwise.

Boolean

This property is deprecated. Will be removed in 9.0

Inherited properties

From com.android.build.api.variant.ComponentIdentity
String?

Build type name.

String?

The multi-flavor name of the variant.

String

Component's name.

List<Pair<StringString>>

List of flavor names.

Public properties

enable

Added in 7.1.0
var enableBoolean

Set to true if the variant is active and should be configured, false otherwise.

If set to false, the matching Component object for this component will not be created.

enabled

Added in 7.0.0
Deprecated in 7.1.0
var enabledBoolean