# Sources

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


```
interface Sources
```

<br />

Known direct subclasses [LibrarySources](https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/LibrarySources)

|---|---|
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/LibrarySources` |   |

*** ** * ** ***

Provides access to all source directories for a `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Variant`.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#getByName(kotlin.String)(name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Access (and potentially creates) a new `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat` for a custom source type that can be referenced by its `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#getByName(kotlin.String)`. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#aidl()` Access to the aidl sources folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildFeatures#aidl()` is true otherwise null |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#assets()` Access to the Android assets sources folders. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#baselineProfiles()` Access to the Baseline profiles source folders. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#java()` Access to the Java source folders. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#jniLibs()` Access to the JNI libraries folders |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#keepRules()` KeepRules files for R8 configuration |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#kotlin()` Access to the Kotlin source folders. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/ManifestFiles` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#manifests()` Access to all android manifest files. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#mlModels()` Access to the machine learning models folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ApplicationBuildFeatures#mlModelBinding()` is true otherwise null |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#renderscript()` Access to the renderscript sources folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildFeatures#renderScript()` is true otherwise null. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#res()` Access to the Android resources sources folders if the component supports android resources or if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/LibraryBuildFeatures#androidResources()` is true for library variants, otherwise null. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#resources()` Access to the Java-style resources sources folders. |
| `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Layered?` | `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#shaders()` Access to the shaders sources folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildFeatures#shaders()` is true otherwise null |

## Public functions

### getByName

Added in 7.2.0

```
fun getByName(name: String): SourceDirectories.Flat
```

Access (and potentially creates) a new `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.Flat` for a custom source type that can be referenced by its `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#getByName(kotlin.String)`.

The first caller will create the new instance, other callers with the same `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/Sources#getByName(kotlin.String)` will get the same instance returned. Any callers can obtain the final list of the folders registered under this custom source type by calling `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/variant/SourceDirectories.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 aidl: SourceDirectories.Flat?
```

Access to the aidl sources folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildFeatures#aidl()` is true otherwise null

### assets

Added in 7.3.0

```
val assets: SourceDirectories.Layered?
```

Access to the Android assets sources folders.

### baselineProfiles

Added in 8.0.2

```
val baselineProfiles: SourceDirectories.Flat?
```

Access to the Baseline profiles source folders.

### java

Added in 7.2.0

```
val java: SourceDirectories.Flat?
```

Access to the Java source folders.

### jniLibs

Added in 7.3.0

```
val jniLibs: SourceDirectories.Layered?
```

Access to the JNI libraries folders

### keepRules

Added in 9.6.0-alpha03

```
val keepRules: SourceDirectories.Flat?
```

KeepRules files for R8 configuration

### kotlin

Added in 7.3.0

```
val kotlin: SourceDirectories.Flat?
```

Access to the Kotlin source folders.

### manifests

Added in 8.3.1

```
val manifests: ManifestFiles
```

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

### mlModels

Added in 7.3.0

```
val mlModels: SourceDirectories.Layered?
```

Access to the machine learning models folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/ApplicationBuildFeatures#mlModelBinding()` is true otherwise null

### renderscript

Added in 7.3.0

```
val renderscript: SourceDirectories.Flat?
```

Access to the renderscript sources folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildFeatures#renderScript()` is true otherwise null. RenderScript APIs are deprecated starting in Android 12 [See more](https://developer.android.com/guide/topics/renderscript/migrate).

### res

Added in 7.3.0

```
val res: SourceDirectories.Layered?
```

Access to the Android resources sources folders if the component supports android resources or if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/LibraryBuildFeatures#androidResources()` is true for library variants, otherwise null.

### resources

Added in 7.4.0

```
val resources: SourceDirectories.Flat?
```

Access to the Java-style resources sources folders.

### shaders

Added in 7.3.0

```
val shaders: SourceDirectories.Layered?
```

Access to the shaders sources folders if `https://developer.android.com/reference/tools/gradle-api/9.6/com/android/build/api/dsl/BuildFeatures#shaders()` is true otherwise null