# SourceDirectories.Layered

[View Source](https://cs.android.com/search?q=file:com/android/build/api/variant/SourceDirectories.kt+class:com.android.build.api.variant.SourceDirectories.Layered) Added in 7.3.0


```
interface SourceDirectories.Layered : SourceDirectories
```

<br />

*** ** * ** ***

Represent a collection of directories that have overlay properties to each other. This mean that some directories will carry higher priority when merging content will be carried out.

The collection is represented as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` where the first elements are the highest priority ones.

For a specific priority, there can be more than one directory defined and is represented as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html`.

Therefore, `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered` can be represented as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` of `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html`.

## Summary

| ### Public properties |
|---|---|
| `https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html<https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html>>>` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered#all()` Get all registered source folders and files as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` of `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html`. |
| `https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html<https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html>>>` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered#static()` Get all registered static file folders (non generated by a Task) as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` of `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html`. |

### Inherited functions

From [com.android.build.api.variant.SourceDirectories](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `<TASK : https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html> https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories#addGeneratedSourceDirectory(org.gradle.api.tasks.TaskProvider,kotlin.Function1)(
taskProvider: https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html<TASK>,
wiredWith: (TASK) -> https://docs.gradle.org/current/javadoc/org/gradle/api/file/DirectoryProperty.html
)`

Add the output of a custom task to the list of source directories.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories#addStaticSourceDirectory(kotlin.String)(srcDir: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Add a source directory with sources already present to the variant.

### Inherited properties

From [org.gradle.api.Named](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html) `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` `https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#name`

## Public properties

### all

```
val all: Provider<List<Collection<Directory>>>
```

Get all registered source folders and files as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` of `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html`.

The outer `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` represents the priority of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html` respective to each other, meaning that elements first in the list overrides elements last in the list.

The inner `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` represents all `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html` with the same priority respective to each other.

The returned `https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html` can be used directly in a `https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/InputFiles.html` annotated property of a `https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html`

### static

Added in 8.4.0

```
val static: Provider<List<Collection<Directory>>>
```

Get all registered static file folders (non generated by a Task) as a `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html` of `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html` of `https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html`.

The returned `https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html` can be used directly in a `https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/InputFiles.html` annotated property of a `https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html`