Skip to content

kimbsu00/AndroidAddressSanitizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Build Guide

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.

Native library build

Required environment

  • ANDROID_NDK: Absolute path to the NDK. Example: /path/to/android/sdk/ndk/27.0.12077973

Optional environment (defaults shown)

  • ANDROID_SDK_ROOT or ANDROID_HOME: Used to locate bundled CMake/Ninja if needed.
  • ANDROID_PLATFORM (default: android-21)
  • ANDROID_STL (default: c++_static)
  • ENABLE_ASAN (default: OFF)

Build commands

AddressSanitizer ON (run from repo root):

export ANDROID_NDK="/path/to/ndk"
ENABLE_ASAN=ON ./NativeAccumulator/build_android_native.sh

AddressSanitizer OFF (run from repo root):

export ANDROID_NDK="/path/to/ndk"
./NativeAccumulator/build_android_native.sh

If 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.sh

Outputs

  • NativeAccumulator/build/android-arm64-v8a/libNativeAccumulator.a
  • NativeAccumulator/build/android-x86_64/libNativeAccumulator.a

Android app build (Gradle)

Gradle will automatically:

  • Copy ASan runtimes into Android/app/src/debug/jniLibs.
  • Generate wrap.sh scripts for ASan preloading.

From the Android/ directory:

./gradlew :app:installDebug

Clean + reinstall (useful after rebuilding the native static lib):

./gradlew :nativelib:clean :app:clean :app:installDebug

About

Android Address Sanitizer Sample Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages