Interface BaseVariant
- All Known Subinterfaces:
ApkVariant,ApplicationVariant,FeatureVariant,com.android.build.gradle.internal.core.InternalBaseVariant,LibraryVariant,TestVariant,UnitTestVariant
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddJavaSourceFoldersToModel(File... sourceFolders) Deprecated.Adds new Java source folders to the model.voidaddJavaSourceFoldersToModel(Collection<File> sourceFolders) Deprecated.Adds new Java source folders to the model.voidbuildConfigField(String type, String name, String value) Deprecated.Adds a variant-specific BuildConfig field.com.android.build.gradle.tasks.AidlCompileDeprecated.org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.AidlCompile>Deprecated.Returns theTaskProviderfor the AIDL compilation task.org.gradle.api.file.FileCollectionDeprecated.Returns file collection containing all raw Android resources, including the ones from transitive dependencies.org.gradle.api.artifacts.ConfigurationDeprecated.Returns the configuration object for the annotation processor.Deprecated.Returns the applicationId of the variant.org.gradle.api.resources.TextResourceDeprecated.useApplicationVariants#getApplicationId().org.gradle.api.TaskDeprecated.org.gradle.api.tasks.TaskProvider<org.gradle.api.Task>Deprecated.Returns theTaskProviderfor the assemble task.Deprecated.Returns the base name for the output of the variant.com.android.builder.model.BuildTypeDeprecated.Returns theBuildTypefor this build variant.org.gradle.api.TaskDeprecated.org.gradle.api.tasks.TaskProvider<org.gradle.api.Task>Deprecated.Returns theTaskProviderfor the check manifest task.org.gradle.api.file.FileCollectionDeprecated.Returns the java compilation classpath.org.gradle.api.artifacts.ArtifactCollectionDeprecated.Returns the java compilation classpath as an ArtifactCollectionorg.gradle.api.artifacts.ConfigurationDeprecated.Returns the configuration object for the compilationDeprecated.Returns a description for the build variant.Deprecated.Returns a subfolder name for the variant.Collection<org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.ExternalNativeBuildTask>>Deprecated.Returns the tasks for building external native projects.Collection<com.android.build.gradle.tasks.ExternalNativeBuildTask>Deprecated.Deprecated.Returns the flavor name of the variant.com.android.build.gradle.tasks.GenerateBuildConfigDeprecated.org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.GenerateBuildConfig>Deprecated.Returns theTaskProviderfor the BuildConfig generation task.org.gradle.api.tasks.compile.JavaCompileDeprecated.com.android.build.gradle.api.JavaCompileOptionsDeprecated.Returns aJavaCompileOptionsthat represents the java compile settings for this build variant.org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.compile.JavaCompile>Deprecated.Returns theTaskProviderfor the Java Compilation taskorg.gradle.api.TaskDeprecated.Deprecated.Please usegetMappingFileProvider()instead in order to avoid task configuration.org.gradle.api.provider.Provider<org.gradle.api.file.FileCollection>Deprecated.Returns the provider of a file collection that contains an obfuscation mapping file.com.android.build.gradle.tasks.MergeSourceSetFoldersDeprecated.org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.MergeSourceSetFolders>Deprecated.Returns theTaskProviderfor the asset merging task.com.android.builder.model.ProductFlavorDeprecated.Returns aProductFlavorthat represents the merging of the default config and the flavors of this build variant.com.android.build.gradle.tasks.MergeResourcesDeprecated.org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.MergeResources>Deprecated.Returns theTaskProviderfor the resource merging task.getName()Deprecated.Returns the name of the variant.org.gradle.api.TaskDeprecated.This always returns nullorg.gradle.api.DomainObjectCollection<BaseVariantOutput>Deprecated.Returns the variant outputs.booleanDeprecated.org.gradle.api.TaskDeprecated.org.gradle.api.tasks.TaskProvider<org.gradle.api.Task>Deprecated.Returns theTaskProviderfor the pre-build anchor task.org.gradle.api.tasks.AbstractCopyTaskDeprecated.org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.AbstractCopyTask>Deprecated.Returns the Java resource processing task.List<com.android.builder.model.ProductFlavor>Deprecated.Returns the list ofProductFlavorfor this build variant.com.android.build.gradle.tasks.RenderscriptCompileDeprecated.org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.RenderscriptCompile>Deprecated.Returns theTaskProviderfor the Renderscript compilation task.org.gradle.api.artifacts.ConfigurationDeprecated.Returns the configuration object for the runtimeList<org.gradle.api.file.ConfigurableFileTree>getSourceFolders(SourceKind folderType) Deprecated.Returns a list of FileCollection representing the source folders.List<com.android.builder.model.SourceProvider>Deprecated.Returns a list of sorted SourceProvider in order of ascending order, meaning, the earlier items are meant to be overridden by later items.voidmissingDimensionStrategy(String dimension, String requestedValue) Deprecated.Set up a new matching request for a given flavor dimension and value.voidmissingDimensionStrategy(String dimension, String... requestedValues) Deprecated.Set up a new matching request for a given flavor dimension and value.voidmissingDimensionStrategy(String dimension, List<String> requestedValues) Deprecated.Set up a new matching request for a given flavor dimension and value.voidregister(org.gradle.api.Task task) Deprecated.Registers a task to be executed before any main output tasks like the assemble or bundle tasks are invoked.voidregisterExternalAptJavaOutput(org.gradle.api.file.ConfigurableFileTree folder) Deprecated.Register the output of an external annotation processor.registerGeneratedBytecode(org.gradle.api.file.FileCollection fileCollection) Deprecated.voidregisterGeneratedResFolders(org.gradle.api.file.FileCollection folders) Deprecated.Adds to the variant new generated resource folders.voidregisterJavaGeneratingTask(org.gradle.api.Task task, File... sourceFolders) Deprecated.voidregisterJavaGeneratingTask(org.gradle.api.Task task, Collection<File> sourceFolders) Deprecated.Use#registerJavaGeneratingTask(TaskProvider, Collection<File>)voidregisterJavaGeneratingTask(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, File... sourceFolders) Deprecated.Adds to the variant a task that generates Java source code.voidregisterJavaGeneratingTask(org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, Collection<File> sourceFolders) Deprecated.Adds to the variant a task that generates Java source code.voidregisterPostJavacGeneratedBytecode(org.gradle.api.file.FileCollection fileCollection) Deprecated.Adds to the variant new generated Java byte-code.registerPreJavacGeneratedBytecode(org.gradle.api.file.FileCollection fileCollection) Deprecated.Adds to the variant new generated Java byte-code.voidregisterResGeneratingTask(org.gradle.api.Task task, File... resFolders) Deprecated.voidregisterResGeneratingTask(org.gradle.api.Task task, Collection<File> resFolders) Deprecated.voidDeprecated.Adds a variant-specific res value.voidsetOutputsAreSigned(boolean isSigned) Deprecated.If true, variant outputs will be considered signed.
-
Method Details
-
getName
Deprecated.Returns the name of the variant. Guaranteed to be unique. -
getDescription
Deprecated.Returns a description for the build variant. -
getDirName
Deprecated.Returns a subfolder name for the variant. Guaranteed to be unique. This is usually a mix of build type and flavor(s) (if applicable). For instance this could be: "debug" "debug/myflavor" "release/Flavor1Flavor2" -
getBaseName
Deprecated.Returns the base name for the output of the variant. Guaranteed to be unique. -
getFlavorName
Deprecated.Returns the flavor name of the variant. This is a concatenation of all the applied flavors- Returns:
- the name of the flavors, or an empty string if there is not flavors.
-
getOutputs
Deprecated.Returns the variant outputs. There should always be at least one output.- Returns:
- a non-null list of variants.
-
getBuildType
@NonNull com.android.builder.model.BuildType getBuildType()Deprecated.Returns theBuildTypefor this build variant. -
getMergedFlavor
@NonNull com.android.builder.model.ProductFlavor getMergedFlavor()Deprecated.Returns aProductFlavorthat represents the merging of the default config and the flavors of this build variant. -
getJavaCompileOptions
@NonNull com.android.build.gradle.api.JavaCompileOptions getJavaCompileOptions()Deprecated.Returns aJavaCompileOptionsthat represents the java compile settings for this build variant. -
getProductFlavors
Deprecated.Returns the list ofProductFlavorfor this build variant.This is always non-null but could be empty.
-
getSourceSets
Deprecated.Returns a list of sorted SourceProvider in order of ascending order, meaning, the earlier items are meant to be overridden by later items.- Returns:
- a list of source provider
-
getSourceFolders
@NonNull List<org.gradle.api.file.ConfigurableFileTree> getSourceFolders(@NonNull SourceKind folderType) Deprecated.Returns a list of FileCollection representing the source folders.You can replace calls to this method by using
Component.getSources(), then use theSources.getJava()and thenSourceDirectories.Flat.getAll().- Parameters:
folderType- the type of folder to return.- Returns:
- a list of folder + dependency as file collections.
-
getCompileConfiguration
@NonNull org.gradle.api.artifacts.Configuration getCompileConfiguration()Deprecated.Returns the configuration object for the compilation -
getAnnotationProcessorConfiguration
@NonNull org.gradle.api.artifacts.Configuration getAnnotationProcessorConfiguration()Deprecated.Returns the configuration object for the annotation processor. -
getRuntimeConfiguration
@NonNull org.gradle.api.artifacts.Configuration getRuntimeConfiguration()Deprecated.Returns the configuration object for the runtime -
getApplicationId
Deprecated.Returns the applicationId of the variant. -
getApplicationIdTextResource
Deprecated.useApplicationVariants#getApplicationId().Returns the true application Id of the variant. For feature variants, this returns the resolved application id from the application. For application variants, this is the same as getApplicationId. -
getPreBuild
Deprecated.Returns the pre-build anchor task -
getPreBuildProvider
@NonNull org.gradle.api.tasks.TaskProvider<org.gradle.api.Task> getPreBuildProvider()Deprecated.Returns theTaskProviderfor the pre-build anchor task.Prefer this to
getPreBuild()as it triggers eager configuration of the task. -
getCheckManifest
Deprecated.Returns the check manifest task. -
getCheckManifestProvider
@NonNull org.gradle.api.tasks.TaskProvider<org.gradle.api.Task> getCheckManifestProvider()Deprecated.Returns theTaskProviderfor the check manifest task.Prefer this to
getCheckManifest()as it triggers eager configuration of the task. -
getAidlCompile
Deprecated.Returns the AIDL compilation task.If aidl feature is disabled via
BuildFeatures.getAidl()this will throw an exception (or returnnullduring sync.) -
getAidlCompileProvider
@Nullable org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.AidlCompile> getAidlCompileProvider()Deprecated.Returns theTaskProviderfor the AIDL compilation task.If aidl feature is disabled via
BuildFeatures.getAidl()this will throw an exception (or returnnullduring sync.)Prefer this to
getAidlCompile()as it triggers eager configuration of the task. -
getRenderscriptCompile
Deprecated.Returns the Renderscript compilation task.If renderscript feature is disabled via
BuildFeatures.getRenderScript()this will throw an exception (or returnnullduring sync.) -
getRenderscriptCompileProvider
@Nullable org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.RenderscriptCompile> getRenderscriptCompileProvider()Deprecated.Returns theTaskProviderfor the Renderscript compilation task.Prefer this to
getRenderscriptCompile()as it triggers eager configuration of the task.If renderscript feature is disabled via
BuildFeatures.getRenderScript()this will throw an exception (or returnnullduring sync.) -
getMergeResources
Deprecated.Returns the resource merging task. -
getMergeResourcesProvider
@Nullable org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.MergeResources> getMergeResourcesProvider()Deprecated.Returns theTaskProviderfor the resource merging task.Prefer this to
getMergeResources()as it triggers eager configuration of the task. -
getMergeAssets
Deprecated.Returns the asset merging task. -
getMergeAssetsProvider
@Nullable org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.MergeSourceSetFolders> getMergeAssetsProvider()Deprecated.Returns theTaskProviderfor the asset merging task.Prefer this to
getMergeAssets()as it triggers eager configuration of the task. -
getGenerateBuildConfig
Deprecated.Returns the BuildConfig generation task. -
getGenerateBuildConfigProvider
@Nullable org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.GenerateBuildConfig> getGenerateBuildConfigProvider()Deprecated.Returns theTaskProviderfor the BuildConfig generation task.Prefer this to
getGenerateBuildConfig()as it triggers eager configuration of the task. -
getJavaCompile
Deprecated.Returns the Java Compilation task -
getJavaCompileProvider
@NonNull org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.compile.JavaCompile> getJavaCompileProvider()Deprecated.Returns theTaskProviderfor the Java Compilation taskPrefer this to
getJavaCompile()as it triggers eager configuration of the task. -
getJavaCompiler
Deprecated.Returns the Java Compiler task. -
getCompileClasspath
Deprecated.Returns the java compilation classpath.The provided key allows controlling how much of the classpath is returned.
- if
null, the full classpath is returned - Otherwise the method returns the classpath up to the generated bytecode associated with the key
- Parameters:
key- the key- See Also:
- if
-
getCompileClasspathArtifacts
@NonNull org.gradle.api.artifacts.ArtifactCollection getCompileClasspathArtifacts(@Nullable Object key) Deprecated.Returns the java compilation classpath as an ArtifactCollectionThe provided key allows controlling how much of the classpath is returned.
- if
null, the full classpath is returned - Otherwise the method returns the classpath up to the generated bytecode associated with the key
- Parameters:
key- the key- See Also:
- if
-
getExternalNativeBuildTasks
@NonNull @Deprecated Collection<com.android.build.gradle.tasks.ExternalNativeBuildTask> getExternalNativeBuildTasks()Deprecated.Returns the tasks for building external native projects. -
getExternalNativeBuildProviders
@NonNull Collection<org.gradle.api.tasks.TaskProvider<com.android.build.gradle.tasks.ExternalNativeBuildTask>> getExternalNativeBuildProviders()Deprecated.Returns the tasks for building external native projects.Prefer this to
getExternalNativeBuildTasks()as it triggers eager configuration of the tasks. -
getObfuscation
Deprecated.This always returns nullReturns the obfuscation task. This can be null if obfuscation is not enabled. -
getMappingFile
Deprecated.Please usegetMappingFileProvider()instead in order to avoid task configuration.Returns the obfuscation mapping file. This can be null if obfuscation is not enabled. -
getMappingFileProvider
@NonNull org.gradle.api.provider.Provider<org.gradle.api.file.FileCollection> getMappingFileProvider()Deprecated.Returns the provider of a file collection that contains an obfuscation mapping file. The file collection may be empty if obfuscation is not enabled. -
getProcessJavaResources
Deprecated.Returns the Java resource processing task. -
getProcessJavaResourcesProvider
@NonNull org.gradle.api.tasks.TaskProvider<org.gradle.api.tasks.AbstractCopyTask> getProcessJavaResourcesProvider()Deprecated.Returns the Java resource processing task.Prefer this to
getProcessJavaResources()as it triggers eager configuration of the task. -
getAssemble
Deprecated.Returns the assemble task for all this variant's output -
getAssembleProvider
@Nullable org.gradle.api.tasks.TaskProvider<org.gradle.api.Task> getAssembleProvider()Deprecated.Returns theTaskProviderfor the assemble task.Prefer this to
getAssemble()as it triggers eager configuration of the task. -
addJavaSourceFoldersToModel
Deprecated.Adds new Java source folders to the model. These source folders will not be used for the default build system, but will be passed along the default Java source folders to whoever queries the model.- Parameters:
sourceFolders- the source folders where the generated source code is.
-
addJavaSourceFoldersToModel
Deprecated.Adds new Java source folders to the model. These source folders will not be used for the default build system, but will be passed along the default Java source folders to whoever queries the model.- Parameters:
sourceFolders- the source folders where the generated source code is.
-
registerJavaGeneratingTask
@Deprecated void registerJavaGeneratingTask(@NonNull org.gradle.api.Task task, @NonNull File... sourceFolders) Deprecated.Adds to the variant a task that generates Java source code.This will make the generate[Variant]Sources task depend on this task and add the new source folders as compilation inputs.
The new source folders are also added to the model.
N.B. This method also supports adding generated Kotlin sources, but this behavior may change in the future. Future versions of AGP or Kotlin Gradle plugin may not support this.
- Parameters:
task- the tasksourceFolders- the source folders where the generated source code is.
-
registerJavaGeneratingTask
@Deprecated void registerJavaGeneratingTask(@NonNull org.gradle.api.Task task, @NonNull Collection<File> sourceFolders) Deprecated.Use#registerJavaGeneratingTask(TaskProvider, Collection<File>)Adds to the variant a task that generates Java source code.This will make the generate[Variant]Sources task depend on this task and add the new source folders as compilation inputs.
The new source folders are also added to the model.
N.B. This method also supports adding generated Kotlin sources, but this behavior may change in the future. Future versions of AGP or Kotlin Gradle plugin may not support this.
- Parameters:
task- the tasksourceFolders- the source folders where the generated source code is.
-
registerJavaGeneratingTask
void registerJavaGeneratingTask(@NonNull org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, @NonNull File... sourceFolders) Deprecated.Adds to the variant a task that generates Java source code.This will make the generate[Variant]Sources task depend on this task and add the new source folders as compilation inputs.
The new source folders are also added to the model.
N.B. This method also supports adding generated Kotlin sources, but this behavior may change in the future. Future versions of AGP or Kotlin Gradle plugin may not support this.
- Parameters:
taskProvider- the task providersourceFolders- the source folders where the generated source code is.
-
registerJavaGeneratingTask
void registerJavaGeneratingTask(@NonNull org.gradle.api.tasks.TaskProvider<? extends org.gradle.api.Task> taskProvider, @NonNull Collection<File> sourceFolders) Deprecated.Adds to the variant a task that generates Java source code.This will make the generate[Variant]Sources task depend on this task and add the new source folders as compilation inputs.
The new source folders are also added to the model.
N.B. This method also supports adding generated Kotlin sources, but this behavior may change in the future. Future versions of AGP or Kotlin Gradle plugin may not support this.
- Parameters:
taskProvider- the task providersourceFolders- the source folders where the generated source code is.
-
registerExternalAptJavaOutput
void registerExternalAptJavaOutput(@NonNull org.gradle.api.file.ConfigurableFileTree folder) Deprecated.Register the output of an external annotation processor.The output is passed to the javac task, but the source generation hooks does not depend on this.
In order to properly wire up tasks, the FileTree object must include dependency information about the task that generates the content of this folders.
- Parameters:
folder- a ConfigurableFileTree that contains a single folder and the task dependency information
-
registerGeneratedResFolders
void registerGeneratedResFolders(@NonNull org.gradle.api.file.FileCollection folders) Deprecated.Adds to the variant new generated resource folders.In order to properly wire up tasks, the FileCollection object must include dependency information about the task that generates the content of this folders.
- Parameters:
folders- a FileCollection that contains the folders and the task dependency information
-
registerResGeneratingTask
@Deprecated void registerResGeneratingTask(@NonNull org.gradle.api.Task task, @NonNull File... resFolders) Deprecated.Adds to the variant a task that generates Resources. This will make the generate[Variant]Resources task depend on this task and add the new Resource folders as Resource merge inputs. The Resource folders are also added to the model.- Parameters:
task- the taskresFolders- the folders where the generated resources are.
-
registerResGeneratingTask
@Deprecated void registerResGeneratingTask(@NonNull org.gradle.api.Task task, @NonNull Collection<File> resFolders) Deprecated.Adds to the variant a task that generates Resources. This will make the generate[Variant]Resources task depend on this task and add the new Resource folders as Resource merge inputs. The Resource folders are also added to the model.- Parameters:
task- the taskresFolders- the folders where the generated resources are.
-
registerPreJavacGeneratedBytecode
Object registerPreJavacGeneratedBytecode(@NonNull org.gradle.api.file.FileCollection fileCollection) Deprecated.Adds to the variant new generated Java byte-code.This bytecode is passed to the javac classpath. This is typically used by compilers for languages that generate bytecode ahead of javac.
The file collection can contain either a folder of class files or jars.
In order to properly wire up tasks, the FileCollection object must include dependency information about the task that generates the content of these folders. This is generally setup using
ConfigurableFileCollection.builtBy(Object...)The generated byte-code will also be added to the transform pipeline as a
QualifiedContent.Scope.PROJECTstream.The method returns a key that can be used to query for the compilation classpath. This allows each successive call to
registerPreJavacGeneratedBytecode(FileCollection)to be associated with a classpath containing everything before the added bytecode.- Parameters:
fileCollection- a FileCollection that contains the files and the task dependency information- Returns:
- a key for calls to
registerGeneratedBytecode(FileCollection)
-
registerGeneratedBytecode
@Deprecated Object registerGeneratedBytecode(@NonNull org.gradle.api.file.FileCollection fileCollection) Deprecated. -
registerPostJavacGeneratedBytecode
void registerPostJavacGeneratedBytecode(@NonNull org.gradle.api.file.FileCollection fileCollection) Deprecated.Adds to the variant new generated Java byte-code.This bytecode is meant to be post javac, which means javac does not have it on its classpath. It's is only added to the java compilation task's classpath and will be added to the transform pipeline as a
QualifiedContent.Scope.PROJECTstream.The file collection can contain either a folder of class files or jars.
In order to properly wire up tasks, the FileCollection object must include dependency information about the task that generates the content of these folders. This is generally setup using
ConfigurableFileCollection.builtBy(Object...)- Parameters:
fileCollection- a FileCollection that contains the files and the task dependency information
-
buildConfigField
Deprecated.Adds a variant-specific BuildConfig field.- Parameters:
type- the type of the fieldname- the name of the fieldvalue- the value of the field
-
resValue
Deprecated.Adds a variant-specific res value.- Parameters:
type- the type of the fieldname- the name of the fieldvalue- the value of the field
-
missingDimensionStrategy
Deprecated.Set up a new matching request for a given flavor dimension and value.To learn more, read Select default flavors for missing dimensions.
- Parameters:
dimension- the flavor dimensionrequestedValue- the flavor name
-
missingDimensionStrategy
Deprecated.Set up a new matching request for a given flavor dimension and value.To learn more, read Select default flavors for missing dimensions.
- Parameters:
dimension- the flavor dimensionrequestedValues- the flavor name and fallbacks
-
missingDimensionStrategy
Deprecated.Set up a new matching request for a given flavor dimension and value.To learn more, read Select default flavors for missing dimensions.
- Parameters:
dimension- the flavor dimensionrequestedValues- the flavor name and fallbacks
-
setOutputsAreSigned
void setOutputsAreSigned(boolean isSigned) Deprecated.If true, variant outputs will be considered signed. Only set if you manually set the outputs to point to signed files built by other tasks. -
getOutputsAreSigned
boolean getOutputsAreSigned()Deprecated.- See Also:
-
getAllRawAndroidResources
@Incubating @NonNull org.gradle.api.file.FileCollection getAllRawAndroidResources()Deprecated.Returns file collection containing all raw Android resources, including the ones from transitive dependencies.This is an incubating API, and it can be changed or removed without notice.
-
register
@Incubating void register(org.gradle.api.Task task) Deprecated.Registers a task to be executed before any main output tasks like the assemble or bundle tasks are invoked.The task will need to set up its dependencies on the build outputs (whether it is an intermediate output or the final one) independently of this call.
-
getAidlCompileProvider()