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 2024-08-28 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-08-28 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-28 UTC."]]