Android NDK configuration to build opus as shared library.
- Clone the opus source code from github (e.g. next to you build.gradle to a folder named
libopus
), using your target opus version (e.g. 1.5.2):git clone --branch=v1.5.2 https://github.com/xiph/opus libopus
- Place the
convert_android_asm.sh
from this repo into the opus root folder and run it from there:./convert_android_asm.sh
- Place the
Android.mk
somewhere (e.g. next to your build.gradle), edit theLOCAL_OPUS_VERSION
to match your version number and letLOCAL_PATH
point to the opus root folder. - Enable the native build instructions in gradle:
Add this to the
android
section of your build.gradle file:Keep in mind that you may need to edit the path if you placed theexternalNativeBuild { ndkBuild{ path "Android.mk" } }
Android.mk
somewhere else in step 3.
The Android.mk
is based on the Android.bp
from the Android OpenSource Project. Currently, opus 1.5.2 is targeted. Also, arm neon optimizations are always on, since