SDK Android XR hiện đã có trong Bản dùng thử cho nhà phát triển. Chúng tôi rất mong nhận được ý kiến phản hồi của bạn! Hãy truy cập vào trang hỗ trợ của chúng tôi để liên hệ.
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.
Để bắt đầu phát triển cho Android XR, hãy sử dụng bản dựng Canary mới nhất của Android Studio. Bản dựng này có các công cụ và bản cập nhật mới được tối ưu hoá cho Android XR.
Các tính năng mới có trong phiên bản Android Studio này là:
Trình mô phỏng Android XR
Thêm tính năng hỗ trợ XR trong Layout Inspector
Mẫu dự án XR
Yêu cầu về hệ thống đối với Trình mô phỏng Android XR
Đối với macOS:
Hệ điều hành: macOS 13.3 trở lên.
CPU/GPU: Apple Silicon (chip M1 trở lên)
RAM/VRAM: 16 GB trở lên
Đối với Windows:
Hệ điều hành: Windows 11 trở lên.
CPU: Intel thế hệ thứ 9 trở lên hoặc AMD Ryzen dòng 1000 trở lên.
RAM: 16 GB trở lên
GPU: Dòng NVIDIA GeForce 10 trở lên hoặc dòng AMD Radeon RX 5000 trở lên.
VRAM: 8 GB trở lên
Chế độ cài đặt BIOS: Bạn phải bật tiện ích CPU VMX trong BIOS của máy tính
Cài đặt và định cấu hình Android Studio để phát triển XR
Hãy hoàn tất các bước sau để tải Android Studio xuống và thiết lập môi trường phát triển:
Đảm bảo bạn đóng mọi phiên bản Android Studio đã cài đặt.
Tải bản dựng Canary mới nhất của Android Studio xuống, giải nén vào vị trí bạn muốn rồi chạy ứng dụng.
Làm theo hướng dẫn cài đặt trong trình hướng dẫn.
Trong hộp thoại Welcome to Android Studio (Chào mừng bạn đến với Android Studio), hãy nhấp vào More Actions (Thao tác khác) rồi chọn SDK Manager (Trình quản lý SDK).
Trên trang Android SDK, hãy nhấp vào thẻ SDK Tools (Bộ công cụ SDK) rồi chọn các công cụ sau để cài đặt:
Công cụ xây dựng SDK Android
Trình mô phỏng Android
Android SDK Platform-Tools
Layout Inspector cho API 31 – 36
Trong thẻ SDK Platforms (Nền tảng SDK), hãy làm như sau:
Đánh dấu vào ô Show Package Details (Hiển thị chi tiết gói) để xem tất cả các lựa chọn.
Chọn hình ảnh hệ thống Google Play XR ARM (macOS) hoặc Google Play XR Intel x86_64 (Windows).
Nhấp vào Áp dụng để cập nhật, rồi nhấp vào OK.
Cho phép hoàn tất tất cả các bước cài đặt, sau đó nhấp vào Hoàn tất.
Tạo một dự án Android XR
Hãy làm theo các bước sau để tạo một dự án Android XR trong Android Studio hoặc mở rộng một dự án hiện có sang XR.
Trong cửa sổ Welcome to Android Studio (Chào mừng bạn đến với Android Studio), hãy làm một trong những việc sau:
Nếu bạn đang tạo một ứng dụng XR mới, hãy nhấp vào New Project (Dự án mới) rồi chuyển sang bước tiếp theo.
Nếu bạn đang không gian hoá một ứng dụng hiện có, hãy nhấp vào Open (Mở) để chọn dự án của bạn, sau đó chuyển sang bước tiếp theo là Tạo thiết bị ảo Android mới cho Trình mô phỏng Android. (Để được trợ giúp về cách không gian hoá ứng dụng hiện có cho Android XR, hãy đọc bài viết Đưa ứng dụng Android vào không gian 3D bằng XR)
Trong danh mục XR, hãy chọn mẫu Basic Headset Activity (Hoạt động cơ bản trên tai nghe) rồi nhấp vào Next (Tiếp theo).
Trên màn hình tiếp theo, bạn có thể chọn tên cho dự án của mình. Bạn có thể giữ nguyên chế độ cài đặt mặc định. Sau đó, nhấp vào Kết thúc.
Tạo Thiết bị Android ảo mới cho Trình mô phỏng Android
Trình mô phỏng Android XR là một phiên bản chuyên biệt của trình mô phỏng Android, được thiết kế để phát triển ứng dụng XR. Công cụ này cho phép bạn kiểm thử và gỡ lỗi các ứng dụng Thực tế mở rộng (XR) trong môi trường Android Studio quen thuộc.
Để sử dụng Trình mô phỏng Android XR, bạn phải tạo một thiết bị ảo mới.
Để thực hiện việc này, hãy làm theo các bước sau:
Trong Android Studio, hãy nhấp vào Tools > AVD Manager (Công cụ > Trình quản lý thiết bị ảo Android) và làm theo hướng dẫn để tạo một Thiết bị Android ảo (AVD) mới.
Trong cửa sổ Add Device (Thêm thiết bị), trong mục Form Factor (Hệ số hình dạng), hãy chọn tuỳ chọn XR, sau đó chọn XR Device (Thiết bị XR) trong danh sách Name (Tên). Nhấp vào Tiếp theo.
Trong thẻ tiếp theo (Configure Virtual Device – Định cấu hình thiết bị ảo), trong phần System Image (Hình ảnh hệ thống), hãy chọn hình ảnh hệ thống Android XR gần đây nhất tương thích với hệ thống của bạn.
Nhấp vào Hoàn tất.
Để khởi động trình mô phỏng, hãy nhấp vào nút Run (Chạy) trong Trình quản lý thiết bị.
Trình mô phỏng sẽ mở trong một cửa sổ riêng.
Để chạy ứng dụng trong trình mô phỏng, hãy nhấp vào biểu tượng Run (Chạy) trong Android Studio.
Để biết thông tin chi tiết về cách sử dụng trình mô phỏng và các công cụ XR mới khác, hãy đọc bài viết Các công cụ Android Studio cho XR.
Bật Số liệu thống kê về việc sử dụng để giúp cải thiện Android Studio
Vì đây là phiên bản dùng thử cho nhà phát triển của Android Studio, nên nhiều tính năng trong số này vẫn đang trong quá trình phát triển. Hãy cân nhắc việc bật số liệu thống kê về mức sử dụng và gửi ý kiến phản hồi để giúp chúng tôi cải thiện những công cụ này.
Cách bật tính năng Số liệu thống kê về việc sử dụng:
Nhấp vào Settings (Cài đặt) > Appearance & Behavior (Giao diện và hành vi) > System Settings (Cài đặt hệ thống) > Data Sharing (Chia sẻ dữ liệu).
Chọn Gửi số liệu thống kê về việc sử dụng cho Google.
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-08-01 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-08-01 UTC."],[],[],null,["# Set up your development environment\n\nTo get started developing for Android XR, use the latest Canary build of\n[Android Studio](/studio/preview), which includes new tools and updates optimized for Android\nXR.\n| **Note:** Ensure you are using the latest Canary build of Android Studio. Other versions might not include Android XR tools.\n\nNew features included in this version of Android Studio are:\n\n- Android XR Emulator\n- Addition of XR support in the Layout Inspector\n- XR Project template\n\nSystem Requirements for Android XR Emulator\n-------------------------------------------\n\n**For macOS:**\n\n- **OS**: macOS 13.3 or later.\n- **CPU/GPU**: Apple Silicon (M1 chip or newer)\n- **RAM/VRAM**: 16 GB or higher\n\n**For Windows:**\n\n- **OS**: Windows 11 or later.\n- **CPU**: Intel 9th generation or later, or AMD Ryzen 1000-series or later.\n- **RAM**: 16 GB or higher\n- **GPU**: NVIDIA GeForce 10 series or later, or AMD Radeon RX 5000 series or later.\n- **VRAM**: 8 GB or higher\n- **BIOS Settings**: VMX CPU extensions must be enabled in your computer's BIOS\n\n| **Note:** You can check if the VMX CPU extensions are already enabled by attempting to run the 2D Android Emulator. If it runs successfully, no BIOS changes are needed.\n\nInstall and configure Android Studio for XR development\n-------------------------------------------------------\n\nComplete the following steps to download Android Studio and set up your\ndevelopment environment:\n\n1. Make sure to close any versions of Android Studio you already have\n installed.\n\n2. Download the latest Canary build of [Android Studio](/studio/preview), extract it into\n your preferred location, and launch the application.\n\n3. Follow the installation instructions in the wizard.\n\n4. In the **Welcome to Android Studio** dialog, click **More Actions** , and\n select **SDK Manager**.\n\n5. In the **Android SDK** page, click the **SDK Tools** tab and select the\n following tools to install:\n\n - Android SDK Build-Tools\n - Android Emulator\n - Android SDK Platform-Tools\n - Layout Inspector for API 31 - 36\n\n | **Note:** If you had a previous version of Android Studio installed, you may need to recheck these boxes, and click **Apply** to download the latest updates.\n6. Under the **SDK Platforms** tab, do the following:\n\n 1. Select the **Show Package Details** checkbox to see all the options.\n 2. Select the **Google Play XR ARM** system image (macOS) or **Google Play\n XR Intel x86_64** (Windows).\n\n 1. Click **Apply** to make the updates, and then click **OK**.\n 2. Allow all the installation steps to complete, then click **Finish**.\n\nCreate an Android XR project\n----------------------------\n\nFollow these steps to create an Android XR project in Android Studio or extend\nan existing project to XR.\n\n1. In the **Welcome to Android Studio** window, do one of the following:\n\n 1. If you're creating a new XR app, click **New Project** and go to the next step.\n 2. If you're spatializing an existing app, click **Open** to select your project, then skip to the next step Create a new Android Virtual Device for the Android Emulator. (For help with spatializing your existing app for Android XR, read [Bring your Android app into 3D with XR](/develop/xr/jetpack-xr-sdk/add-xr-to-existing))\n\n2. In the **XR** category, select the **Basic Headset Activity** template and\n click **Next**.\n\n3. On the next screen you can choose a name for your project. You can leave the\n default settings in place. Then click **Finish**.\n\n4. Explore the code provided in the template. Check out our [development\n guide](/develop/xr/jetpack-xr-sdk/develop-ui) and [reference documentation](/jetpack/androidx/releases/xr-compose).\n\nCreate a new Android Virtual Device for the Android Emulator\n------------------------------------------------------------\n\nThe Android XR Emulator is a specialized version of the Android emulator\ndesigned for XR app development. It lets you test and debug your Extended\nReality (XR) applications within the familiar Android Studio environment.\n| **Caution:** In rare cases, using the emulator can result in system freezes or crashes on some Windows configurations. Please ensure all data is saved before running the emulator. As a workaround, [enable WHPX](/studio/run/emulator-acceleration#vm-windows-whpx). See [release notes](/studio/preview/features) for more known issues.\n\nTo use the Android XR Emulator, you'll have to create a new virtual device.\nFollow these steps to do so:\n\n1. In Android Studio, click **Tools \\\u003e AVD Manager**, and follow the\n instructions to create a new Android Virtual Device (AVD).\n\n2. In the **Add Device** window, under **Form Factor** , select the **XR**\n option, then select **XR Device** in the **Name** list. Click **Next**.\n\n3. In the next tab (**Configure Virtual Device** ), under **System Image**,\n select the most recent Android XR system image that is compatible with your\n system.\n\n4. Click **Finish**.\n\n5. To start the emulator, click the **Run** button in Device Manager.\n\n The emulator opens in a separate window.\n\n6. To launch your app in the emulator, click the **Run** icon in Android\n Studio.\n\nFor details on using the emulator and other new XR tools, read [Android\nStudio Tools for XR](/develop/xr/jetpack-xr-sdk/studio-tools).\n\nEnable Usage Statistics to help improve Android Studio\n------------------------------------------------------\n\nBecause this is a developer preview version of Android Studio, many of these\nfeatures are still under development. Consider enabling usage statistics and\nsending feedback to help us improve these tools.\n\nTo enable Usage Statistics:\n\n1. Click **Settings \\\u003e Appearance \\& Behavior \\\u003e System Settings \\\u003e Data Sharing**.\n2. Select **Send usage statistics to google**."]]