Component

public interface Component extends ComponentIdentity

Known direct subclasses
TestComponent
TestFixtures
Variant

Parent interface for all types of variants.

Known indirect subclasses
AndroidTest

Properties for the android test Variant of a module.

ApplicationVariant

Properties for the main Variant of an application.

DynamicFeatureVariant
LibraryVariant

Variant for Library projects

TestVariant

Variant for test-only modules.

UnitTest

This interface is deprecated. Use the com.android.build.api.variant package

UnitTest

Summary

Public methods

abstract @NonNull Configuration

Access to the variant's annotation processor Configuration; for example, the debugAnnotationProcessor Configuration for the debug variant.

abstract @NonNull Artifacts

Access to the variant's buildable artifacts for build customization.

abstract @NonNull FileCollection

Access to the variant's compile classpath.

abstract @NonNull Configuration

Access to the variant's compile Configuration; for example, the debugCompileClasspath Configuration for the debug variant.

abstract @NonNull Instrumentation

Access to the variant's instrumentation options.

abstract @NonNull JavaCompilation

Access to the variant's java compilation options.

abstract @NonNull Provider<@NonNull String>

The namespace of the generated R and BuildConfig classes.

abstract @NonNull Configuration

Access to the variant's runtime Configuration; for example, the debugRuntimeClasspath Configuration for the debug variant.

abstract @NonNull Sources

Access to variant's source files.

abstract void

This method is deprecated. Will be removed in v9.0, use the instrumentation block.

abstract void
<ParamT extends InstrumentationParameters> transformClassesWith(
    @NonNull Class<@NonNull AsmClassVisitorFactory<@NonNull ParamT>> classVisitorFactoryImplClass,
    @NonNull InstrumentationScope scope,
    @NonNull Function1<@NonNull ParamT, Unit> instrumentationParamsConfig
)

This method is deprecated. Will be removed in v9.0, use the instrumentation block.

Inherited methods

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

Build type name, might be replaced with access to locked DSL object once ready.

abstract String

The multi-flavor name of the variant.

abstract @NonNull String

Component's name.

abstract @NonNull List<@NonNull Pair<@NonNull String, @NonNull String>>

List of flavor names, might be replaced with access to locked DSL objects once ready.

Public methods

getAnnotationProcessorConfiguration

abstract @NonNull Configuration getAnnotationProcessorConfiguration()

Access to the variant's annotation processor Configuration; for example, the debugAnnotationProcessor Configuration for the debug variant.

The returned Configuration should not be resolved until execution time.

getArtifacts

abstract @NonNull Artifacts getArtifacts()

Access to the variant's buildable artifacts for build customization.

getCompileClasspath

@Incubating
abstract @NonNull FileCollection getCompileClasspath()

Access to the variant's compile classpath.

The returned FileCollection should not be resolved until execution time.

getCompileConfiguration

abstract @NonNull Configuration getCompileConfiguration()

Access to the variant's compile Configuration; for example, the debugCompileClasspath Configuration for the debug variant.

The returned Configuration should not be resolved until execution time.

getInstrumentation

abstract @NonNull Instrumentation getInstrumentation()

Access to the variant's instrumentation options.

getJavaCompilation

@Incubating
abstract @NonNull JavaCompilation getJavaCompilation()

Access to the variant's java compilation options.

getNamespace

abstract @NonNull Provider<@NonNull StringgetNamespace()

The namespace of the generated R and BuildConfig classes. Also, the namespace used to resolve any relative class names that are declared in the AndroidManifest.xml.

getRuntimeConfiguration

abstract @NonNull Configuration getRuntimeConfiguration()

Access to the variant's runtime Configuration; for example, the debugRuntimeClasspath Configuration for the debug variant.

The returned Configuration should not be resolved until execution time.

getSources

abstract @NonNull Sources getSources()

Access to variant's source files.

setAsmFramesComputationMode

abstract void setAsmFramesComputationMode(@NonNull FramesComputationMode mode)

transformClassesWith

abstract void <ParamT extends InstrumentationParameters> transformClassesWith(
    @NonNull Class<@NonNull AsmClassVisitorFactory<@NonNull ParamT>> classVisitorFactoryImplClass,
    @NonNull InstrumentationScope scope,
    @NonNull Function1<@NonNull ParamT, Unit> instrumentationParamsConfig
)