

In this case, you can specify gradle property rust-target to the target you're testing right now. Sometimes, during development, you don't need to build for all targets ( arm, arm64), since you only test on one specific phone, so you don't want to spend time waiting for unused targets to be built. Let's talk about some features, that might be helpful during development.

Any of those options can be overridden for a specific buildType. The full list of options can be found on the GitHub page: All Options. Now, for both buildTypes release profile is going to be built.

Next step is to add android targets for rust:ĬargoNdk Here are official instructions on how to install NDK: Install NDK. Once Android Studio is installed you also need NDK. Currently (to my opinion) it works better than rls + vscode. It can be downloaded from its official site: Android Studio.Īlso, I would suggest installing the Rust plugin: IntelliJ Rust, Toml. To develop for Android you will need Android Studio. I assume that the Rust compiler itself is installed. I will only cover the main plugin use cases in detail. I won't spend much time talking about details that were already covered in the article above. Here it is Cargo NDK for Android projects. For me it is crucial, so I decided to write my own plugin. It is very good, but it misses one thing - it doesn't allow you to configure different compilation options for different gradle buildTypes. I would prefer if Rust compilation was done automatically by gradle.Īs it happens there is already such plugin: Rust Android Gradle by Mozilla. That might be not the most convenient way to do it, since it makes the whole compilation and installing a several step process. However, they describe how to build Rust manually (from the command line). There are already several good articles on how to develop on Rust for Android: Building and Deploying a Rust library on Android by Mozilla, and Rust once and share it with Android, iOS, and Flutter by Roberto Huertas.
