Rust는 성능과 안전, 특히 메모리 안전에 중점을 둔 최신 시스템 프로그래밍 언어입니다. Rust는 중요한 시스템 구성요소를 개발하는 데 있어 C/C++의 더 안전한 대안으로 Android 생태계에서 점점 더 중요해지고 있으며, 보안과 안정성이 개선되었습니다.
이 페이지에서는 Android 오픈소스 프로젝트 (AOSP) 프로젝트 내에서 Rust 개발을 지원하도록 플랫폼용 Android 스튜디오 (ASfP)를 설정하는 방법을 안내합니다.
기본 요건
ASfP 설치됨: ASfP가 설치되어 있고 실행 중인지 확인합니다.
플랫폼 체크아웃: 머신에 작동하는 AOSP 플랫폼 체크아웃이 필요합니다.
Rust 지원 사용 설정
ASfP 프로젝트에서 Rust 지원을 작동시키기 위한 단계별 프로세스는 다음과 같습니다.
Rust 사용 설정
설정 마법사에서 새 프로젝트를 만들 때 Rust 체크박스를 선택하기만 하면 됩니다.
새 프로젝트 설정 마법사의 Rust 체크박스
기존 프로젝트의 경우 .asfp-project 구성으로 이동하여 other_languages에 rust을 추가합니다.
other_languages:-cpp-rust```
<figure>
<img src="/studio/platform/images/1-modify_asfp_project_languages.png" alt="Modifying the .asfp-project file to add rust to other_languages" class="screenshot">
<figcaption>Adding Rust support in the <code>.asfp-project</code> file.</figcaption></figure>
프로젝트 동기화:
이전 단계를 실행한 후 모든 변경사항이 적용되고 IDE에서 Rust 프로젝트를 인식하도록 프로젝트 동기화를 트리거해야 합니다. File > Sync Project로 이동합니다.
성공 여부 확인
이 단계를 완료한 후 다음을 수행합니다.
프로젝트 뷰 (소스 iml 아래)에 rust-project.json가 표시됩니다. 이 파일은 분석 중에 Soong에 의해 생성되고 저장소 루트에 심볼릭 링크됩니다. 이는 LSP가 언어 서비스를 제공하는 데 필요합니다. 이 파일을 직접 수정하지 마세요. 대신 Soong이 처리하도록 다시 동기화하세요.
.asfp-project 구성의 other_languages 아래에 rust가 있는지 다시 확인하세요.
rust-project.json이 생성되었는지 확인합니다.
IDE에서 아래에 설명되고 표시된 Rust 관련 기능이 사용 설정되어 있어야 합니다.
주요 Rust IDE 기능
코드 완성: 다른 모듈의 항목을 비롯한 Rust 코드에 대한 지능형 제안을 받습니다.
다른 Rust 모듈의 항목을 제안하는 코드 완성
탐색: 정의로 빠르게 이동하고 프로젝트 전체에서 Rust 심볼의 사용을 찾습니다.
Rust 기호의 정의로 이동합니다.Rust 심볼의 모든 사용 사례 찾기
도움말: 기호 위로 마우스를 가져가면 유형 정보와 문서가 표시됩니다.
다른 모듈의 Rust 심볼에 관한 유형 정보를 보여주는 도움말
인레이 힌트: 편집기에서 직접 유형 정보와 기타 컨텍스트 힌트를 확인합니다.
코드 내에 유형 정보를 보여주는 인레이 힌트
구조 뷰:구조 도구 창 (보기 > 도구 창 > 구조)을 사용하여 Rust 파일의 구조를 탐색합니다.
Rust 파일의 개요를 보여주는 구조 도구 창
리팩터링: 안전하게 심볼 이름을 바꾸고 모든 사용 사례를 업데이트합니다.
Rust 심볼의 이름을 바꾸고 모든 참조를 업데이트합니다.
실시간 분석: Rust 코드의 오류 및 경고에 대한 즉각적인 피드백을 받습니다.
Rust 코드에서 실시간 오류 및 경고를 보여주는 IDE
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-09-05(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[],[],null,["Overview\n\nRust is a modern systems programming language focused on performance and safety,\nparticularly memory safety. Rust is increasingly important in the Android\necosystem as a safer alternative to C/C++ for developing critical system\ncomponents, offering improved security and stability.\n\nThis page guides you through setting up Android Studio for Platform (ASfP) to\nsupport Rust development within your Android Open Source Project (AOSP)\nprojects.\n\nPrerequisites\n\n- **ASfP Installed:** Verify you have ASfP installed and running.\n- **Platform checkout:** You need a working AOSP platform checkout on your machine.\n\nEnabling Rust support\n\nHere's the step-by-step process to get Rust support working in your ASfP\nproject:\n\n1. **Enable Rust**\n\n - When creating a **new project** in the setup wizard, simply check the box for Rust:\n\n Rust checkbox in new project setup wizard.\n - For existing projects, navigate to your `.asfp-project` config and add `rust` to `other_languages`:\n\n other_languages:\n - cpp\n - rust\n ```\n\n \u003cfigure\u003e\n \u003cimg src=\"/studio/platform/images/1-modify_asfp_project_languages.png\" alt=\"Modifying the .asfp-project file to add rust to other_languages\" class=\"screenshot\"\u003e\n \u003cfigcaption\u003eAdding Rust support in the \u003ccode\u003e.asfp-project\u003c/code\u003e file.\u003c/figcaption\u003e\n \u003c/figure\u003e\n\n\u003c!-- --\u003e\n\n1. **Sync your project:**\n\n - After performing the previous steps, you need to trigger a project sync to ensure that all changes are applied and the IDE recognizes the Rust project: Go to **File \\\u003e Sync Project**.\n\nVerifying success\n\nAfter completing these steps:\n\n- You should see `rust-project.json` in your project view (under the source\n iml). This file is generated by Soong during analysis and symlinked to the\n repo root, which is necessary for LSP to provide language services. **DO\n NOT** edit this file directly; instead, re-sync to let Soong handle it.\n\n As a reminder, double check that `rust` is present under `other_languages`\n in your `.asfp-project` config.\n Ensure that `rust-project.json` has been generated.\n- You should see Rust-specific features (described and shown below) enabled in\n your IDE.\n\nKey Rust IDE features\n\n- **Code completion:** Get intelligent suggestions for Rust code, including\n items from other modules.\n\n Code completion suggesting items from a different Rust module.\n\n \u003cbr /\u003e\n\n- **Navigation:** Quickly jump to definitions and find usages of Rust symbols\n across your project.\n\n Navigating to the definition of a Rust symbol. Finding all usages of a Rust symbol.\n\n \u003cbr /\u003e\n\n- **Tooltips:** Hover over symbols to see type information and documentation.\n\n Tooltip showing type information for a Rust symbol from another module.\n\n \u003cbr /\u003e\n\n- **Inlay hints:** View type information and other contextual hints directly\n in the editor.\n\n Inlay hints showing type information within the code.\n\n \u003cbr /\u003e\n\n- **Structure view:** Navigate the structure of your Rust files using the\n **Structure** tool window (View \\\u003e Tool Windows \\\u003e Structure).\n\n The structure tool window showing the outline of a Rust file.\n\n \u003cbr /\u003e\n\n- **Refactoring:** Safely rename symbols and have all usages updated.\n\n Renaming a Rust symbol and updating all its references.\n\n \u003cbr /\u003e\n\n- **Real-time analysis:** Get instant feedback on errors and warnings in your\n Rust code.\n\n IDE showing real-time errors and warnings in Rust code.\n\n \u003cbr /\u003e"]]