How to make IntelliJ compile like `cargo ndk ...`?
โ Rust ๐ 2025-09-18 ๐ค surdeus ๐๏ธ 10Iโm trying to build an app for various platforms. For Android, I use this command line:
cargo ndk -t arm64-v8a -o ./MyAndroidApp/app/src/main/jniLibs build -p my-app --lib
That works great. It comes from cargo install cargo-ndk. It builds a .so library and I then use Android Studio to complete the app. But if I make the mistake of clicking Run or Build in IntelliJ (my Rust IDE) instead of Android Studio, then it does something to wipe the build results. Even if I kill it, if I then go back to cargo ndk โฆ, the cargo command rebuilds everything.
Itโs an annoyance. I wonder if there is a way, when Iโm working on Android, to tell IntelliJ about this cargo ndk โฆ command.
IntelliJ does see my .cargo/config.toml with the line:
target = "aarch64-linux-android"
And that causes IntelliJ to display sections marked #[cfg(target_os = โandroidโ)] as active, which is nice, the build command still seems to be incompatible.
1 post - 1 participant
๐ท๏ธ Rust_feed