Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Rust IDE setup
Stay organized with collections
Save and categorize content based on your preferences.
The IDE support for Rust in Android relies on rust-analyzer.
rust-analyzer
is a language server protocol
used by your IDE to understand the code structure and to provide features
such as code completion or jump-to definition. Before you start, search the
rust-analyzer QuickStart documentation for how to configure your
IDE or editor to use the rust-analyzer
protocol.
Android provides the configuration that enables rust-analyzer
to understand
how Android Rust modules are built. This is described in the Soong-generated file
rust-project.json
. For some IDEs such as Visual Studio Code, this file is
generated by aidegen
,
using the -l r
option arguments (to select Rust as the language). If you use
a different IDE, manually generate a rust-project.json
file with the following code:
// Generates rust-project.json in out/soong/
SOONG_GEN_RUST_PROJECT=1 m nothing
// Creates a symbolic link
ln -s $ANDROID_BUILD_TOP/out/soong/rust-project.json $ANDROID_BUILD_TOP
A prebuilt, stable version of rust-analyzer
is available in-tree at
prebuilts/rust/linux-x86/stable/rust-analyzer.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.
[null,null,["Last updated 2025-08-29 UTC."],[],[],null,["# Rust IDE setup\n\nThe IDE support for Rust in Android relies on [rust-analyzer](https://rust-analyzer.github.io/).\n`rust-analyzer` is a [language server protocol](https://microsoft.github.io/language-server-protocol/)\nused by your IDE to understand the code structure and to provide features\nsuch as code completion or jump-to definition. Before you start, search the\n[rust-analyzer QuickStart](https://rust-analyzer.github.io/) documentation for how to configure your\nIDE or editor to use the `rust-analyzer` protocol.\n\nAndroid provides the configuration that enables `rust-analyzer` to understand\nhow Android Rust modules are built. This is described in the Soong-generated file\n`rust-project.json`. For some IDEs such as Visual Studio Code, this file is\ngenerated by [`aidegen`](https://android.googlesource.com/platform/tools/asuite/+/refs/heads/android16-release/aidegen/README.md#2_basic-usage),\nusing the `-l r` option arguments (to select Rust as the language). If you use\na different IDE, manually generate a `rust-project.json` file with the following code: \n\n // Generates rust-project.json in out/soong/\n SOONG_GEN_RUST_PROJECT=1 m nothing\n // Creates a symbolic link\n ln -s $ANDROID_BUILD_TOP/out/soong/rust-project.json $ANDROID_BUILD_TOP\n\nA prebuilt, stable version of `rust-analyzer` is available in-tree at\n[prebuilts/rust/linux-x86/stable/rust-analyzer](https://cs.android.com/android/platform/superproject/+/android-latest-release:prebuilts/rust/linux-x86/stable/rust-analyzer)."]]