Stay organized with collections
Save and categorize content based on your preferences.
BuiltArtifactsLoader
interface BuiltArtifactsLoader
Facility to load BuiltArtifacts
instances from metadata files in the file system.
When an artifact can have more than one output file, its com.android.build.api.artifact.SingleArtifact
is annotated with com.android.build.api.artifact.SingleArtifact.ContainsMany. com.android.build.api.artifact.ArtifactTypes.APK is an example of such an artifact: the folder produced can contain multiple APK files when multi-apk build is configured.
To be able to understand the content of such a folder, and in particular to know which file is associated with which VariantFilter
, a metadata file is stored along side the artifact files.
BuiltArtifactsLoader
will allow to load the content of the metadata file is obtained information about each file produced by AGP.
This interface should not be implemented by third party.
Implementation of this interface can be obtained from com.android.build.api.artifact.Artifacts.getBuiltArtifactsLoader
Summary
Public functions
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# BuiltArtifactsLoader\n====================\n\n\n```\ninterface BuiltArtifactsLoader\n```\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nFacility to load [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts) instances from metadata files in the file system.\n\nWhen an artifact can have more than one output file, its [com.android.build.api.artifact.SingleArtifact](/reference/tools/gradle-api/7.2/com/android/build/api/artifact/SingleArtifact) is annotated with com.android.build.api.artifact.SingleArtifact.ContainsMany. com.android.build.api.artifact.ArtifactTypes.APK is an example of such an artifact: the folder produced can contain multiple APK files when multi-apk build is configured.\n\nTo be able to understand the content of such a folder, and in particular to know which file is associated with which [VariantFilter](/reference/tools/gradle-api/7.2/com/android/build/api/variant/VariantFilter), a metadata file is stored along side the artifact files.\n\n[BuiltArtifactsLoader](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader) will allow to load the content of the metadata file is obtained information about each file produced by AGP.\n\nThis interface should not be implemented by third party.\n\nImplementation of this interface can be obtained from [com.android.build.api.artifact.Artifacts.getBuiltArtifactsLoader](/reference/tools/gradle-api/7.2/com/android/build/api/artifact/Artifacts#getBuiltArtifactsLoader())\n\nSummary\n-------\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts)`?` | [load](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader#load(org.gradle.api.file.Directory))`(folder: `[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)`?)` Loads a metadata file from the provided [folder](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader#load(org.gradle.api.file.Directory)) and returns a new [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts) containing the [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html) of [BuiltArtifact](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifact) that are present in the [folder](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader#load(org.gradle.api.file.Directory)) |\n| [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts)`?` | [load](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader#load(org.gradle.api.file.FileCollection))`(fileCollection: `[FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html)`?)` Loads a metadata file from the provided [FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html) and returns a new [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts) containing the [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html) of [BuiltArtifact](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifact) that are present in the [FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html) |\n\nPublic functions\n----------------\n\n### load\n\n```\nfun load(folder: Directory?): BuiltArtifacts?\n```\n\nLoads a metadata file from the provided [folder](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader#load(org.gradle.api.file.Directory)) and returns a new [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts) containing the [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html) of [BuiltArtifact](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifact) that are present in the [folder](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifactsLoader#load(org.gradle.api.file.Directory)) \n\n| Parameters ||\n|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `folder: `[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)`?` | the directory abstraction that should contain built artifacts and associated metadata file saved using the [BuiltArtifacts.save](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts#save(org.gradle.api.file.Directory)) methods. |\n\n### load\n\n```\nfun load(fileCollection: FileCollection?): BuiltArtifacts?\n```\n\nLoads a metadata file from the provided [FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html) and returns a new [BuiltArtifacts](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts) containing the [Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html) of [BuiltArtifact](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifact) that are present in the [FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html) \n\n| Parameters ||\n|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `fileCollection: `[FileCollection](https://docs.gradle.org/current/javadoc/org/gradle/api/file/FileCollection.html)`?` | the file collection that should contain built artifacts and associated metadata file saved using the [BuiltArtifacts.save](/reference/tools/gradle-api/7.2/com/android/build/api/variant/BuiltArtifacts#save(org.gradle.api.file.Directory)) methods. |"]]