Tạo hoặc nhập dự án
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Android Studio for Platform (ASfP) giúp bạn thiết lập môi trường phát triển cho Dự án nguồn mở Android (AOSP). Trang này giải thích cách bắt đầu một dự án mới hoặc nhập một dự án hiện có.
Tạo dự án mới
Nếu bạn chưa mở dự án nào, hãy nhấp vào New Project (Dự án mới) trên màn hình Chào mừng. 
Nếu bạn đã mở một dự án, hãy chọn ASfP > Project > New Project (ASfP > Dự án > Dự án mới) trong trình đơn.
Điền thông tin chi tiết về cấu hình dự án trong trình hướng dẫn: 
- Đường dẫn mô-đun: Chỉ định đường dẫn tuyệt đối đến thư mục gốc của quy trình kiểm xuất mã nguồn AOSP (ví dụ:
/path/to/aosp
).
- Mục tiêu khởi chạy: Nhập mục tiêu khởi chạy mà bạn dùng để tạo (ví dụ:
aosp_arm64-eng
).
- Tên dự án: Đặt tên mô tả cho dự án.
- Thư mục / mô-đun: Liệt kê các thư mục hoặc mô-đun ban đầu mà bạn muốn đưa vào dự án, phân tách bằng dấu phẩy. Đây phải là các đường dẫn tương đối từ thư mục gốc của kho lưu trữ (ví dụ:
frameworks/base,
packages/apps/Settings
). Bạn có thể thêm hoặc tinh chỉnh lựa chọn này sau.
Nhấp vào Hoàn tất. ASfP tạo cấu trúc dự án và tệp cấu hình .asfp-project
.
Sau khi thiết lập dự án ban đầu, bạn có thể tuỳ chỉnh thêm dự án của mình bằng cách chỉnh sửa tệp .asfp-project
nằm trong thư mục gốc của dự án. Tệp này cho phép bạn:
- Thêm hoặc xoá thư mục và mô-đun.
- Hỗ trợ các ngôn ngữ khác như Rust hoặc C++.
- Định cấu hình cờ bản dựng và biến môi trường.
- Chỉ định các nguồn kiểm thử.
Để biết thông tin chi tiết về tất cả các lựa chọn cấu hình, hãy xem phần Tổng quan về dự án. Sau khi chỉnh sửa .asfp-project
, bạn cần đồng bộ hoá dự án để các thay đổi có hiệu lực.
Nhập dự án hiện có
ASfP không có thao tác "nhập" riêng biệt. Cách mở một cấu hình dự án ASfP hiện có:
- Chọn ASfP > Project > New Project (ASfP > Dự án > Dự án mới).
- Trong trường Project Name (Tên dự án), hãy chuyển đến và chọn thư mục chứa tệp
.asfp-project
hiện có mà bạn muốn mở. Các trường trong trình hướng dẫn sẽ điền sẵn dựa trên tệp .asfp-project
đã chọn.
- Nhấp vào Hoàn tất. ASfP sẽ mở và lập chỉ mục dự án.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-09-04 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-09-04 UTC."],[],[],null,["Android Studio for Platform (ASfP) helps you set up your development environment\nfor the [Android Open Source Project (AOSP)](https://source.android.com/). This page explains how to\nstart a new project or import an existing one.\n\nCreate a new project\n\n1. If you don't have a project open, click **New Project** on the Welcome\n screen.\n\n2. If you already have a project open, select **ASfP \\\u003e Project \\\u003e New Project**\n from the menu.\n\n3. Fill in the project configuration details in the wizard:\n\n - **Module paths:** Specify the absolute path to the root of your AOSP source code checkout (for example, `/path/to/aosp`).\n - **Lunch target:** Enter the lunch target you use for building (for example, `aosp_arm64-eng`).\n - **Project name:** Give your project a descriptive name.\n - **Directories / modules:** List the initial directories or modules you want to include in your project, separated by commas. These should be relative paths from the repository root (for example, `frameworks/base,\n packages/apps/Settings`). You can add more or refine this selection later.\n4. Click **Finish** . ASfP creates the project structure and the `.asfp-project`\n configuration file.\n\nConfigure and customize your project\n\nAfter the initial project setup, you can further customize your project by\nediting the `.asfp-project` file located in the project root. This file lets\nyou:\n\n- Add or remove directories and modules.\n- Enable support for other languages like Rust or C++.\n- Configure build flags and environment variables.\n- Specify test sources.\n\nFor detailed information on all configuration options, see the [Projects\noverview](/studio/platform/projects). After editing `.asfp-project`, you'll need to sync the project for\nthe changes to take effect.\n\nImport an existing project\n\nASfP doesn't have a separate \"import\" action. To open an existing ASfP project\nconfiguration:\n\n1. Select **ASfP \\\u003e Project \\\u003e New Project**.\n2. In the **Project Name** field, navigate to and select the directory containing the existing `.asfp-project` file you want to open. The fields in the wizard will populate based on the selected `.asfp-project` file.\n3. Click **Finish**. ASfP opens and indexes the project."]]