Crates.io | cargo-xdk |
lib.rs | cargo-xdk |
version | 2.12.6 |
source | src |
created_at | 2022-02-10 08:00:19.841479 |
updated_at | 2023-02-14 09:14:41.041969 |
description | Makes building Rust libraries for Android simpler |
homepage | https://github.com/tiann/cargo-xdk |
repository | https://github.com/tiann/cargo-xdk |
max_upload_size | |
id | 530120 |
size | 58,430 |
This cargo extension handles all the environment configuration needed for successfully building libraries
for Android from a Rust codebase, with support for generating the correct jniLibs
directory structure.
cargo install cargo-xdk
You'll also need to install all the toolchains you intend to use. Simplest way is with the following:
rustup target add \
aarch64-linux-android \
armv7-linux-androideabi \
x86_64-linux-android \
i686-linux-android
Modify as necessary for your use case.
If you have installed the NDK with Android Studio to its default location, cargo ndk
will automatically detect
the most recent NDK version and use it. This can be overriden by specifying the path to the NDK root directory in
the ANDROID_NDK_HOME
environment variable.
cargo ndk -t armeabi-v7a -t arm64-v8a -o ./jniLibs build --release
This specifies the Android targets to be built, the output directory to use for placing the .so
files in the layout
expected by Android, and then the ordinary flags to be passed to cargo
.
This project is just a fork of cargo-ndk; But the author refused to add features, such as #43, so I republish it.
git clone
and then install the crate with cargo
:
cargo install --path .
This project is licensed under either of