How to Build a Shared Rust Library for Android and iOS

Use the neon CLI tool to create and build a shared Rust library for Android and iOS with a single command.

Use the neon crate to compile your Rust library into a single binary compatible with both Android and iOS.

cargo install neon-cli
neon create mylib
# Add your Rust code to src/lib.rs
neon build --release

This generates a target/release folder containing the compiled library for your current platform. To build for the other platform, install the corresponding Xcode (iOS) or Android SDK (Android) and run neon build again with the appropriate environment.