Sources

Added in 7.2.0

interface Sources

Provides access to all source directories for a Variant.

Summary

Public functions

SourceDirectories.Flat

Access (and potentially creates) a new Flat for a custom source type that can be referenced by its name.

Public properties

SourceDirectories.Flat?

Access to the aidl sources folders if com.android.build.api.dsl.BuildFeatures.aidl is true otherwise null

SourceDirectories.Layered?

Access to the Android assets sources folders.

SourceDirectories.Flat?

Access to the Baseline profiles source folders.

SourceDirectories.Flat?

Access to the Java source folders.

SourceDirectories.Layered?

Access to the JNI libraries folders

SourceDirectories.Flat?

Access to the Kotlin source folders.

ManifestFiles

Access to all android manifest files.

SourceDirectories.Layered?

Access to the machine learning models folders if com.android.build.api.dsl.ApplicationBuildFeatures.mlModelBinding is true otherwise null

SourceDirectories.Flat?

Access to the renderscript sources folders if com.android.build.api.dsl.BuildFeatures.renderScript is true otherwise null.

SourceDirectories.Layered?

Access to the Android resources sources folders if the component supports android resources or if com.android.build.api.dsl.LibraryBuildFeatures.androidResources is true for library variants, otherwise null.

SourceDirectories.Flat?

Access to the Java-style resources sources folders.

SourceDirectories.Layered?

Access to the shaders sources folders if com.android.build.api.dsl.BuildFeatures.shaders is true otherwise null

Public functions

getByName

Added in 7.2.0
@Incubating
fun getByName(name: String): SourceDirectories.Flat

Access (and potentially creates) a new Flat for a custom source type that can be referenced by its name.

The first caller will create the new instance, other callers with the same name will get the same instance returned. Any callers can obtain the final list of the folders registered under this custom source type by calling Flat.all.

These sources directories are attached to the variant and will be visible to Android Studio.

Public properties

aidl

Added in 7.3.0
val aidlSourceDirectories.Flat?

Access to the aidl sources folders if com.android.build.api.dsl.BuildFeatures.aidl is true otherwise null

assets

Added in 7.3.0
val assetsSourceDirectories.Layered?

Access to the Android assets sources folders.

baselineProfiles

Added in 8.0.0
val baselineProfilesSourceDirectories.Flat?

Access to the Baseline profiles source folders.

java

Added in 7.2.0
val javaSourceDirectories.Flat?

Access to the Java source folders.

jniLibs

Added in 7.3.0
val jniLibsSourceDirectories.Layered?

Access to the JNI libraries folders

kotlin

Added in 7.3.0
val kotlinSourceDirectories.Flat?

Access to the Kotlin source folders.

manifests

Added in 8.4.2
val manifestsManifestFiles

Access to all android manifest files. Main manifest file is always the first one.

mlModels

Added in 7.3.0
val mlModelsSourceDirectories.Layered?

Access to the machine learning models folders if com.android.build.api.dsl.ApplicationBuildFeatures.mlModelBinding is true otherwise null

renderscript

Added in 7.3.0
Deprecated in 7.3.0
val renderscriptSourceDirectories.Flat?

Access to the renderscript sources folders if com.android.build.api.dsl.BuildFeatures.renderScript is true otherwise null. RenderScript APIs are deprecated starting in Android 12 See more.

res

Added in 7.3.0
val resSourceDirectories.Layered?

Access to the Android resources sources folders if the component supports android resources or if com.android.build.api.dsl.LibraryBuildFeatures.androidResources is true for library variants, otherwise null.

resources

Added in 7.4.0
val resourcesSourceDirectories.Flat?

Access to the Java-style resources sources folders.

shaders

Added in 7.3.0
val shadersSourceDirectories.Layered?

Access to the shaders sources folders if com.android.build.api.dsl.BuildFeatures.shaders is true otherwise null