

This will build an Android package in target/android-artifacts//apk. In the project root for your Android crate, run cargo apk build. Set the environment variables NDK_HOME to the path of the NDK and ANDROID_HOME to the path of the SDK.Install cargo-apk with cargo install cargo-apk.android-sdk/tools/bin/sdkmanager "platform-tools" "platforms android-29" "build-tools 29.0.0". Install the Java JRE or JDK (on Ubuntu, sudo apt-get install openjdk-8-jdk).rustup target add aarch64-linux-android.rustup target add armv7-linux-androideabi.

Building will attempt to build for all supported targets unless the build targets are adjusted via Cargo.toml. Run rustup target add for all supported targets to which you want to compile.This needs to be done only once per system. Manual usage Setting up your environmentīefore you can compile for Android, you need to setup your environment.

Docker run -rm -v "$(pwd):/root/src" -w /root/src philipalldredge/cargo-apk cargo apk buildĭo not mount a volume on /root or you will erase the local installation of Cargo.Īfter the build is finished, you should get an Android package in target/android-artifacts/debug/apk.
