skills/filament_android_development/SKILL.md
This skill details the procedures for compiling binaries for Android, installing them onto a physical device or emulator, and running tests and benchmarks.
Android binaries should almost always be built in release mode for testing and benchmarking.
To build the release version targeting the arm64-v8a architecture, and optionally enable Perfetto tracing (the -P flag, which is highly recommended during performance development):
./build.sh -q arm64-v8a -Pip desktop release
Push the compiled executable (test or benchmark) to a writable temporary directory (such as /data/local/tmp) on the connected Android device using adb:
adb push ./out/cmake-android-release-aarch64/{path-to-executable} /data/local/tmp
Replace {path-to-executable} with the actual relative path to your compiled binary under out/cmake-android-release-aarch64/.
Run the pushed binary inside the Android device's shell.
You must set LD_LIBRARY_PATH to the directory containing the pushed binary so that the dynamic linker can locate target proprietary shared libraries:
adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/{executable}
When running performance benchmarks on Android devices, always conform to the following formatting rules:
--benchmark_counters_tabular)--benchmark_color=true)ms or us, rarely ns):adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/{executable} --benchmark_counters_tabular --benchmark_color=true --benchmark_time_unit=ms