TestVariant

public interface TestVariant extends GeneratesTestApk, Variant


Variant for test-only modules.

Summary

Public methods

abstract @NonNull Property<@NonNull String>

Variant's application ID as present in the final manifest file of the APK.

abstract @NonNull Provider<@NonNull String>

The application of the app under tests.

Inherited methods

From com.android.build.api.variant.Component
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.

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.

From com.android.build.api.variant.GeneratesApk
abstract @NonNull AndroidResources

Variant's android resources processing configuration, initialized by the corresponding global DSL element.

abstract @NonNull ApkPackaging

Variant's packagingOptions, initialized by the corresponding global DSL element.

abstract Renderscript

Variant specific settings for the renderscript compiler.

abstract @NonNull AndroidVersion

Target SDK version for this variant.

abstract @NonNull AndroidVersion
From com.android.build.api.variant.GeneratesTestApk
abstract @NonNull Property<@NonNull Boolean>

The functionalTest value to use to run the tests.

abstract @NonNull Property<@NonNull Boolean>

The handleProfiling value to use to run the tests.

abstract @NonNull Property<@NonNull String>

The instrumentationRunner to use to run the tests.

abstract @NonNull MapProperty<@NonNull String, @NonNull String>

The instrumentationRunnerArguments to use to run the tests.

abstract @NonNull Property<String>

The test label.

From com.android.build.api.variant.HasAndroidResources
abstract @NonNull Property<@NonNull Boolean>

Variant's is pseudo locales enabled, initialized by the corresponding DSL elements.

abstract @NonNull MapProperty<@NonNull ResValue.Key, @NonNull ResValue>

Variant's ResValue which will be generated.

abstract @NonNull ResValue.Key

Make a ResValue.Key to interact with resValues's MapProperty

From com.android.build.api.variant.Variant
abstract @NonNull MapProperty<@NonNull String, @NonNull BuildConfigField<@NonNull Serializable>>

Variant's BuildConfigField which will be generated in the BuildConfig class.

abstract @NonNull List<@NonNull Component>

List containing this variant and all of its nestedComponents

abstract @NonNull MapProperty<@NonNull String, @NonNull Object>

Additional per variant experimental properties.

abstract T
<T extends Object> getExtension(@NonNull Class<@NonNull T> type)

Returns an extension object registered via the VariantBuilder.registerExtension API or null if none were registered under the passed type.

abstract ExternalNativeBuild

Variant's cmake ExternalNativeBuild, initialized by merging the product flavor values or null if no cmake external build is configured for this variant.

abstract @NonNull MapProperty<@NonNull String, @NonNull String>

MapProperty of the variant's manifest placeholders.

abstract Integer

Gets the maximum supported SDK Version for this variant.

abstract Integer
abstract @NonNull AndroidVersion

Gets the minimum supported SDK Version for this variant.

abstract @NonNull AndroidVersion
abstract @NonNull List<@NonNull Component>

List of the components nested in this variant, the returned list will contain:

abstract @NonNull ListProperty<@NonNull RegularFile>

List of proguard configuration files for this variant.

abstract UnitTest

Variant's UnitTest, or null if the unit tests for this variant are disabled.

abstract void
@Incubating
missingDimensionStrategy(
    @NonNull String dimension,
    @NonNull String requestedValues
)

Set up a new matching request for a given flavor dimension and value.

Public methods

getApplicationId

abstract @NonNull Property<@NonNull StringgetApplicationId()

Variant's application ID as present in the final manifest file of the APK.

getTestedApplicationId

abstract @NonNull Provider<@NonNull StringgetTestedApplicationId()

The application of the app under tests.