Skip to content

Building Android

Taner Sener edited this page Jul 15, 2026 · 2 revisions

FFmpegKitNext for Android can be built with the recommended Nix wrapper or by calling the direct Android build script.

Before building, review Android Prerequisites. For the full Android option reference, see nix‐android.sh.

Build With Nix

Use the Nix wrapper for normal builds, CI builds and reproducible host environments.

./nix-android.sh --list-profiles
./nix-android.sh -p android-r27d

The wrapper enters the selected Nix profile and then calls scripts/start-android.sh inside that environment.

Build Without Nix

If you maintain the Android SDK, NDK, JDK and host tools yourself, call the direct script from the project root:

./scripts/start-android.sh

The direct script uses the environment described in Android Prerequisites, especially ANDROID_SDK_ROOT, ANDROID_NDK_ROOT and JAVA_HOME.

Build Options

The same Android build options can be passed to both commands. For example:

./nix-android.sh -p android-r27d --enable-libwebp --disable-arm-v7a-neon
./scripts/start-android.sh --enable-libwebp --disable-arm-v7a-neon

Use --enable-gpl when enabling GPL-licensed libraries such as x264, x265, xvidcore, libvidstab or rubberband.

The complete option list is documented in nix‐android.sh.

Build Flow

The Android build has three phases:

  1. Build FFmpeg and enabled external libraries with the Android NDK toolchain.
  2. Build the native FFmpegKitNext Android library with ndk-build.
  3. Package the Kotlin/Java API and native libraries into an Android Archive (.aar) with the Gradle wrapper.

Build Output

Build outputs are written under prebuilt.

A default API 24 Android build creates a local Maven repository similar to:

prebuilt/bundle-android-aar-24-maven/
  com/arthenica/ffmpeg-kit-next/<version>/
    ffmpeg-kit-next-<version>.aar
    ffmpeg-kit-next-<version>.pom

Use the generated local Maven repository from your Android application or copy it into your own artifact repository.

Clone this wiki locally