Android ExoPlayer 2 Flac extension — Part 1

In the first part we let’s build ExoPlayer flac extension.

The Flac support in ExoPlayer 2 has been moved to the flac extensions module. So to use this format, we need to compile and add the flac extension for our project.
In this tutorial, I’ll show you some steps to compile the flac extension.

Build Instructions

Create a directory in your favorite location and clone the repository. ( Git setup is required for this step.)

Clone the repository

git clone

Move to dev-v2-r2.5.0 branch or the your version required

git checkout origin:dev-v2-r2.5.0 -b dev-v2-r2.5.0

Set the following environment variables

We need to download Android NDK before to start this step.


Download and extract flac-1.3.1 as “${FLAC_EXT_PATH}/jni/flac” folder

cd “${FLAC_EXT_PATH}/jni” && \ curl | tar xJ && \ mv flac-1.3.1 flac

Build the JNI native libraries from the command line

cd “${FLAC_EXT_PATH}”/jni && \ ${NDK_PATH}/ndk-build APP_ABI=all -j4

Generate AAR file, we need to download Android SDK

export ANDROID_HOME=“your/sdk/path”
./gradlew :extension-flac:assembleDebug

After this a extension-flac-debug.aar file will be created in following path:


Ready!!!! We have a flac extension compiled e ready to use. The next part we’ll create a Android Project to show flac media executing.

Thanks for reading this brief introduction of Exoplayer 2 extensions.

Get here a compiled file ( branch dev-v2-r2.5.0).