Stay organized with collections
Save and categorize content based on your preferences.
Artifacts
interface Artifacts
Access to the artifacts on a Variant object.
Artifacts are temporary or final files or directories that are produced by the Android Gradle
plugin during the build. Depending on its configuration, each com.android.build.api.variant.VariantBuilder
produces different versions of some of the output artifacts.
An example of temporary artifacts are .class files obtained from compiling source files that will
eventually get transformed further into dex files. Final artifacts are APKs and bundle files that
are not transformed further.
Artifacts are uniquely defined by their Artifact type and public artifact types that can be
accessed from third-party plugins or build script are defined in SingleArtifact
Summary
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Artifacts\n=========\n\n```\ninterface Artifacts\n```\n\n|-----------------------------------------------|\n| [com.android.build.api.artifact.Artifacts](#) |\n\nAccess to the artifacts on a Variant object.\n\nArtifacts are temporary or final files or directories that are produced by the Android Gradle\nplugin during the build. Depending on its configuration, each [com.android.build.api.variant.VariantBuilder](../variant/VariantBuilder.html#)\nproduces different versions of some of the output artifacts.\n\nAn example of temporary artifacts are .class files obtained from compiling source files that will\neventually get transformed further into dex files. Final artifacts are APKs and bundle files that\nare not transformed further.\n\nArtifacts are uniquely defined by their [Artifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/Artifact) type and public artifact types that can be\naccessed from third-party plugins or build script are defined in [SingleArtifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/SingleArtifact)\n\nSummary\n-------\n\n| ### Public methods ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)\\\u003cFileTypeT\\\u003e | [get](#get(com.android.build.api.artifact.SingleArtifact))`(`type:` `[SingleArtifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/SingleArtifact)\u003cFileTypeT\u003e`)` Get the [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html) of FileTypeT for the passed [Artifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/Artifact). |\n| abstract [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)\\\u003c[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)\\\u003cFileTypeT\\\u003e\\\u003e | [getAll](#getAll(com.android.build.api.artifact.MultipleArtifact))`(`type:` `[MultipleArtifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/MultipleArtifact)\u003cFileTypeT\u003e`)` Get all the [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)s of FileTypeT for the passed [Artifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/Artifact). |\n| abstract [BuiltArtifactsLoader](../variant/BuiltArtifactsLoader.html#) | [getBuiltArtifactsLoader](#getBuiltArtifactsLoader())`()` Provides an implementation of [BuiltArtifactsLoader](../variant/BuiltArtifactsLoader.html#) that can be used to load built artifacts metadata. |\n| abstract [TaskBasedOperation](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/TaskBasedOperation)\\\u003cTaskT\\\u003e | [use](#use(org.gradle.api.tasks.TaskProvider))`(`taskProvider:` `[TaskProvider](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html)\u003cTaskT\u003e`)` Access [Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html) based operations. |\n\nPublic methods\n--------------\n\n### get\n\n```\nabstract fun \u003cFileTypeT : FileSystemLocation\u003e get(type: SingleArtifact\u003cFileTypeT\u003e): Provider\u003cFileTypeT\u003e\n```\n\nGet the [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html) of FileTypeT for the passed [Artifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/Artifact).\n\n| Parameters ||\n|--------------------------------------------------------------------------------------------------------------------|------------------------------|\n| type: [SingleArtifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/SingleArtifact)\\\u003cFileTypeT\\\u003e | Type of the single artifact. |\n\n### getAll\n\n```\nabstract fun \u003cFileTypeT : FileSystemLocation\u003e getAll(type: MultipleArtifact\u003cFileTypeT\u003e): Provider\u003cList\u003cFileTypeT\u003e\u003e\n```\n\nGet all the [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)s of FileTypeT for the passed [Artifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/Artifact).\n\n| Parameters ||\n|------------------------------------------------------------------------------------------------------------------------|--------------------------------|\n| type: [MultipleArtifact](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/MultipleArtifact)\\\u003cFileTypeT\\\u003e | Type of the multiple artifact. |\n\n### getBuiltArtifactsLoader\n\n```\nabstract fun getBuiltArtifactsLoader(): BuiltArtifactsLoader\n```\n\nProvides an implementation of [BuiltArtifactsLoader](../variant/BuiltArtifactsLoader.html#) that can be used to load built artifacts\nmetadata.\n\n| Return ||\n|---|---|\n| A thread safe implementation of [BuiltArtifactsLoader](../variant/BuiltArtifactsLoader.html#) that can be reused. ||\n\n### use\n\n```\nabstract fun \u003cTaskT : Task\u003e use(taskProvider: TaskProvider\u003cTaskT\u003e): TaskBasedOperation\u003cTaskT\u003e\n```\n\nAccess [Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html) based operations.\n\n| Parameters ||\n|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| taskProvider: [TaskProvider](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html)\\\u003cTaskT\\\u003e | The [TaskProvider](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html) for the TaskT that will be producing and/or consuming artifact types. |\n\n| Return ||\n|---|---|\n| A [TaskBasedOperation](/reference/tools/gradle-api/7.1/com/android/build/api/artifact/TaskBasedOperation) object using the passed [TaskProvider](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html) for all its operations. ||"]]