Skip to content

Building library for Android

John Stone edited this page Jun 19, 2020 · 20 revisions
  • Install rustup

  • Make sure you've the Android NDK installed, and that the NDK_HOME environment variable points to it. E.g:

echo $NDK_HOME
/Users/foo/Library/Android/sdk/ndk/21.3.6528147/
cargo install cargo-ndk
  • Add toolchains:
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android 

The list of targets above is not necessarily up to date. See e.g. here for current targets. Use rustup target list to see a list of currently supported targets.

  • Set Android path environmental variable to your local repo using: 'export PATH_TO_ANDROID_REPO=<your_path_here>'"

  • Run the script, which will build the libraries and copy them to the Android local copy:

sh ./scripts/android/create_android.sh
  • To build and copy a release version pass the --release flag to the script
sh ./scripts/android/create_android.sh --release
Clone this wiki locally