[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
 
 

cargo-so

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

cargo so

Tool for compile Rust package to Android .so lib files. Code modified from cargo-apk

Installation

cargo install --path .

Usage

Assuming your computer already has Android Studio installed, go to Android Studio > Tools > SDK Manager > Android SDK > SDK Tools. Check the following options for installation and click OK.

  • Android SDK Build-Tools
  • Android SDK Command-line Tools
  • NDK(Side by side)

Set two following environment variables:

export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
# Replace the NDK version number with the version you installed 
export NDK_HOME=$ANDROID_SDK_ROOT/ndk/23.1.7779620

Add build targets

rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android

Build

# build to all android targets
cargo so build --lib 
# build to the specified target
cargo so b --lib --target aarch64-linux-android