← ClaudeAtlas

rust-android-buildlisted

Use when you build, verify, or package a Rust cdylib for Android - install cross-compilation targets, set up the NDK toolchain, write per-ABI rustflags in .cargo/config.toml, enforce 16 KiB page alignment, tune a size-optimized release profile, audit the exported ELF symbol set, hold .so size budgets, or drive the cargo build from a Gradle task that produces jniLibs.
po4yka/rust-skills · ★ 2 · AI & Automation · score 76
Install: claude install-skill po4yka/rust-skills
# Rust Android Build This skill covers the build-and-verify discipline for a Rust `cdylib` that ships inside an Android app: which rustflags go where, how to prove 16 KiB alignment per ABI, which symbols the `.so` is allowed to export, how to hold a size budget, and how a Gradle task drives cargo. Version note: the NDK details below describe NDK 29 at time of writing. Check the NDK release notes after any bump and re-verify the artifacts. ## When to use this skill - You edit `.cargo/config.toml` for any `*-linux-android*` target. - You edit the release profile that the Android build uses. - You audit a built `.so` before a release. - You review the Gradle wiring that calls cargo. - You investigate a store rejection that cites 16 KiB alignment, a native crash, or an unexpected exported symbol. ## Target mapping | Android ABI | Rust target triple | |-------------|--------------------| | `arm64-v8a` | `aarch64-linux-android` | | `armeabi-v7a` | `armv7-linux-androideabi` | | `x86_64` | `x86_64-linux-android` | | `x86` | `i686-linux-android` | Use `armv7-linux-androideabi` for `armeabi-v7a`. Do not write `armv7a-` in a Cargo target position: that spelling is the NDK linker wrapper name, not a Rust target triple. The two differ only for this ABI, and the mismatch is a common build failure. See the linker table below. Install the targets you ship: ```bash rustup target add \ aarch64-linux-android \ armv7-linux-androideabi \ x86_64-linux-android \ i686-linu