# LibraryLoader

# LibraryLoader

Artifact:[androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/common/util/LibraryLoader.java+class:androidx.media3.common.util.LibraryLoader)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/util/LibraryLoader "View this page in Java")

<br />

```
@UnstableApi
abstract class LibraryLoader
```

<br />

*** ** * ** ***

Configurable loader for native libraries.

## Summary

|                                                                                                                                                       ### Public constructors                                                                                                                                                       |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [LibraryLoader](https://developer.android.com/reference/kotlin/androidx/media3/common/util/LibraryLoader#LibraryLoader(java.lang.String...))`(libraries: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!)` |

|                                     ### Public functions                                     |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `synchronized `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [setLibraries](https://developer.android.com/reference/kotlin/androidx/media3/common/util/LibraryLoader#setLibraries(java.lang.String...))`(libraries: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!)` Overrides the names of the libraries to load. |

|                                 ### Protected functions                                  |
|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [loadLibrary](https://developer.android.com/reference/kotlin/androidx/media3/common/util/LibraryLoader#loadLibrary(java.lang.String))`(name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Should be implemented to call`System.loadLibrary(name)`. |

|                                ### Public properties                                |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isAvailable](https://developer.android.com/reference/kotlin/androidx/media3/common/util/LibraryLoader#isAvailable()) |

## Public constructors

### LibraryLoader

```
LibraryLoader(libraries: Array<String!>!)
```  

|                                                                                      Parameters                                                                                       |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| `libraries: `[Array](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!` | The names of the libraries to load. |

## Public functions

### setLibraries

```
synchronized fun setLibraries(libraries: Array<String!>!): Unit
```

Overrides the names of the libraries to load. Must be called before any call to[isAvailable](https://developer.android.com/reference/kotlin/androidx/media3/common/util/LibraryLoader#isAvailable()).  

## Protected functions

### loadLibrary

```
protected abstract fun loadLibrary(name: String!): Unit
```

Should be implemented to call`System.loadLibrary(name)`.

It's necessary for each subclass to implement this method because[loadLibrary](https://developer.android.com/reference/java/lang/System.html#loadLibrary(java.lang.String))uses reflection to obtain the calling class, which is then used to obtain the class loader to use when loading the native library. If this class were to implement the method directly, and if a subclass were to have a different class loader, then loading of the native library would fail.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|----------------------------------|
| `name: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The name of the library to load. |

## Public properties

### isAvailable

```
val isAvailable: Boolean
```