# Artifact

# Artifact

```
@Incubating abstract class Artifact<T : FileSystemLocation> : Serializable
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                   ||
| ↳ | [com.android.build.api.artifact.Artifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#) |

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [Artifact.MultipleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.MultipleArtifact),[Artifact.SingleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.SingleArtifact) |----------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Artifact.MultipleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.MultipleArtifact) | Denotes possible multiple[FileSystemLocation](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileSystemLocation.html)instances for this artifact type.      | | [Artifact.SingleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.SingleArtifact)     | Denotes a single[FileSystemLocation](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileSystemLocation.html)instance of this artifact type at a given time. | |

|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Indirect Subclasses [ArtifactType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType),[ArtifactType.APK](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.APK),[ArtifactType.BUNDLE](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.BUNDLE),[ArtifactType.MERGED_MANIFEST](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.MERGED_MANIFEST),[ArtifactType.OBFUSCATION_MAPPING_FILE](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.OBFUSCATION_MAPPING_FILE),[MultipleArtifactType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/MultipleArtifactType) |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| | [ArtifactType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType)                                                   | Public[Artifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#)for Android Gradle plugin. | | [ArtifactType.APK](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.APK)                                           | APK directory where final APK files will be located.                                                                                              | | [ArtifactType.BUNDLE](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.BUNDLE)                                     | <br />                                                                                                                                            | | [ArtifactType.MERGED_MANIFEST](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.MERGED_MANIFEST)                   | Merged manifest file that will be used in the APK, Bundle and InstantApp packages.                                                                | | [ArtifactType.OBFUSCATION_MAPPING_FILE](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactType.OBFUSCATION_MAPPING_FILE) | <br />                                                                                                                                            | | [MultipleArtifactType](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/MultipleArtifactType)                                   | Public[Artifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#)for Android Gradle plugin. | |

Defines a type of artifact handled by the Android Gradle Plugin.

Each instance of[Artifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#)is produced by a[org.gradle.api.Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html)and potentially consumed by any number of tasks.

An artifact can potentially be produced by more than one task (each task acting in an additive behavior), but consumers must be aware when more than one artifact can be present, implementing the[MultipleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.MultipleArtifact)interface will indicate such requirement.

An artifact must be one of the supported[ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)and must be provided when the constructor is called. ArtifactKind also defines the specific[FileSystemLocation](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileSystemLocation.html)subclass used.

## Summary

|                                                                                                                                                                                                                                                                 ### Nested classes                                                                                                                                                                                                                                                                 ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract | [Appendable](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.Appendable) Denotes an artifact type that can be appended to.                                                                                                                                                                                                                                                                                                                                                          |
| abstract | [ContainsMany](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.ContainsMany) Denotes a single[DIRECTORY](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#Companion.DIRECTORY:com.android.build.api.artifact.ArtifactKind.DIRECTORY)that may contain zero to many[com.android.build.api.variant.BuiltArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/variant/BuiltArtifact.html#). |
| abstract | [MultipleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.MultipleArtifact) Denotes possible multiple[FileSystemLocation](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileSystemLocation.html)instances for this artifact type.                                                                                                                                                                                                                            |
| abstract | [Replaceable](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.Replaceable) Denotes an artifact type that can be replaced.                                                                                                                                                                                                                                                                                                                                                           |
| abstract | [SingleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.SingleArtifact) Denotes a single[FileSystemLocation](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileSystemLocation.html)instance of this artifact type at a given time.                                                                                                                                                                                                                           |
| abstract | [Transformable](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.Transformable) Denotes an artifact type that can transformed.                                                                                                                                                                                                                                                                                                                                                       |

|                                                                                                                                                                               ### Public constructors                                                                                                                                                                               ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [<init>](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#%3Cinit%3E(com.android.build.api.artifact.ArtifactKind))`(`kind:` `[ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)<T>`)` Defines a type of artifact handled by the Android Gradle Plugin. |

|                                                                                                                       ### Public methods                                                                                                                       ||
|--------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getFileSystemLocationName](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#getFileSystemLocationName())`()` <br /> |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getFolderName](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#getFolderName())`()` <br />                         |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)     | [name](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#name())`()` Provide a unique name for the artifact type.     |

|                                                                                                                                           ### Properties                                                                                                                                            ||
|-------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)\<T\> | [kind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#kind:com.android.build.api.artifact.ArtifactKind) <br /> |

|                                                                                                                                                                                                                                                                   ### Companion properties                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ArtifactKind.DIRECTORY](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind.DIRECTORY) | [DIRECTORY](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#Companion.DIRECTORY:com.android.build.api.artifact.ArtifactKind.DIRECTORY) [ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)for[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html) |
| [ArtifactKind.FILE](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind.FILE)           | [FILE](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#Companion.FILE:com.android.build.api.artifact.ArtifactKind.FILE) [ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)for[RegularFile](https://docs.gradle.org/current/javadoc/org/gradle/api/file/RegularFile.html)            |

## Public constructors

### \<init\>

```
Artifact(kind: ArtifactKind<T>)
```

Defines a type of artifact handled by the Android Gradle Plugin.

Each instance of[Artifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact#)is produced by a[org.gradle.api.Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html)and potentially consumed by any number of tasks.

An artifact can potentially be produced by more than one task (each task acting in an additive behavior), but consumers must be aware when more than one artifact can be present, implementing the[MultipleArtifact](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/Artifact.MultipleArtifact)interface will indicate such requirement.

An artifact must be one of the supported[ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)and must be provided when the constructor is called. ArtifactKind also defines the specific[FileSystemLocation](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileSystemLocation.html)subclass used.

## Public methods

### getFileSystemLocationName

```
open fun getFileSystemLocationName(): String
```

| Return ||
|---|---|
| Depending on T, returns the file name of the folder under the variant-specific folder or an empty string to use defaults. ||

### getFolderName

```
open fun getFolderName(): String
```

| Return ||
|---|---|
| The folder name under which the artifact files or folders should be stored. ||

### name

```
fun name(): String
```

Provide a unique name for the artifact type. For external plugins defining new types, consider adding the plugin name to the artifact's name to avoid collision with other plugins.

## Properties

### kind

```
val kind: ArtifactKind<T>
```

## Companion properties

### DIRECTORY

```
val DIRECTORY: ArtifactKind.DIRECTORY
```

[ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)for[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)  

### FILE

```
val FILE: ArtifactKind.FILE
```

[ArtifactKind](https://developer.android.com/reference/tools/gradle-api/4.1/com/android/build/api/artifact/ArtifactKind)for[RegularFile](https://docs.gradle.org/current/javadoc/org/gradle/api/file/RegularFile.html)