This repository builds a native static library (NativeAccumulator) and an
Android app that links it. The native build is driven by
NativeAccumulator/build_android_native.sh.
ANDROID_NDK: Absolute path to the NDK. Example:/path/to/android/sdk/ndk/27.0.12077973
ANDROID_SDK_ROOTorANDROID_HOME: Used to locate bundled CMake/Ninja if needed.ANDROID_PLATFORM(default:android-21)ANDROID_STL(default:c++_static)ENABLE_ASAN(default:OFF)
AddressSanitizer ON (run from repo root):
export ANDROID_NDK="/path/to/ndk"
ENABLE_ASAN=ON ./NativeAccumulator/build_android_native.shAddressSanitizer OFF (run from repo root):
export ANDROID_NDK="/path/to/ndk"
./NativeAccumulator/build_android_native.shIf you need a shared STL to match the Android app build, set:
export ANDROID_NDK="/path/to/ndk"
export ANDROID_STL="c++_shared"
ENABLE_ASAN=ON ./NativeAccumulator/build_android_native.shNativeAccumulator/build/android-arm64-v8a/libNativeAccumulator.aNativeAccumulator/build/android-x86_64/libNativeAccumulator.a
Gradle will automatically:
- Copy ASan runtimes into
Android/app/src/debug/jniLibs. - Generate
wrap.shscripts for ASan preloading.
From the Android/ directory:
./gradlew :app:installDebugClean + reinstall (useful after rebuilding the native static lib):
./gradlew :nativelib:clean :app:clean :app:installDebug