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.shfrom this repo into the opus root folder and run it from there:./convert_android_asm.sh - Place the
Android.mksomewhere (e.g. next to your build.gradle), edit theLOCAL_OPUS_VERSIONto match your version number and letLOCAL_PATHpoint to the opus root folder. - Enable the native build instructions in gradle:
Add this to the
androidsection 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.mksomewhere 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