[[["易于理解","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"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Android Studio tools for XR\n\nThis documentation walks you through using the Android XR Emulator and the\nLayout Inspector in Android Studio for building an XR app.\n| **Note:** Ensure you are using the latest Canary build of Android Studio. Other versions might not include Android XR tools. See [Set up your development\n| environment](/develop/xr/jetpack-xr-sdk/setup) for more information.\n| **Preview:** This is a Canary build. Many features are still in development, and not all Android Studio features work with XR.\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\nAndroid Studio includes the following new features for XR:\n\n- Android XR Emulator\n- XR Support in Layout Inspector\n\nAndroid XR Emulator\n-------------------\n\nThe Android XR Emulator provides a virtualized XR device for testing and\ndebugging your XR apps in Android Studio. It emulates an XR device, allowing you\nto experience your app in a 3D spatial environment. This lets you build your\napps without the need for physical hardware during early development stages,\nstreamlining your workflow and accelerating iteration.\n| **Note:** The emulator is designed for developing Android apps in Android Studio. It's not currently supported for OpenXR or Unity applications of any kind.\n\nIf this is your first time using an emulator with Android Studio, consider\nreviewing [general documentation for the Android emulator](/studio/run/emulator).\n\n### Launch the Android XR Emulator\n\nAfter [installing the Android XR Emulator](/develop/xr/jetpack-xr-sdk/setup), click the **Run** button in\nDevice Manager on the device.\n\n### Enable the mouse and keyboard\n\nCurrently, the emulator supports only mouse and keyboard input. When using the\nemulator, make sure the keyboard and mouse icon is selected.\n\nOnce you've done this, you can start interacting with various elements within\nthe virtual space by moving the mouse over the emulator window.\n\n### Look and move around in the virtual environment\n\nThe Android XR emulator renders application elements in a virtual 3D\nenvironment. Use the following controls to change the direction of your view,\npan, dolly, rotate, and reset:\n\n|---|---------------------------------------------------------------------------------------------------------------------------------------|\n| | Pan: Click and drag the mouse to move up, down, and side to side. This will allow viewing the emulator contents from different angles |\n| | Dolly: Click and drag the mouse to move closer or farther from the objects in view |\n| | Rotate: Click and drag the mouse to pivot your view in that direction |\n| | Reset: Click this button to return the emulator to the default view |\n\nYou can also use the following keyboard shortcuts to move around in the virtual\nenvironment. To use these while using mouse and keyboard input, hold the Option\nkey (macOS) or Alt key (Windows).\n\n- W (or up arrow key): Move forward in your current view.\n- A (or left arrow key): Side-step left.\n- S: (or down arrow key): Move backward.\n- D (or right arrow key): Side-step right.\n- Q: Move vertically downward.\n- E: Move vertically upward.\n\n### Enable passthrough mode\n\nUse the following menu option to enable or disable a simulated passthrough\nenvironment.\n\nWhen enabled, passthrough mode will display a simulated indoor environment. Use\nthis mode to test applications in mixed reality.\n\n### Other Emulator Controls\n\n|--------|--------------------------------------------------------------------------|\n| | Power: Simulates powering the device on or off |\n| | Volume: Simulates volume control |\n| | Screenshot: Takes a screenshot of the current state of the device |\n| :back: | Android 3 button control: Simulates the back, Home, and Overview buttons |\n\n### Troubleshooting\n\nCheck the [release notes](/studio/releases) for any known issues and workarounds.\n\nIf you encounter a problem that is not a known issue, view the [support page](/studio/report-bugs)\nfor instructions on getting help and reporting issues.\n\nIncluding a crash report or a bug report will help us better understand the\nissue. Screenshots and recordings also provide additional details needed. The\ninstructions in this section explain how to upload a crash report and use adb to\ngenerate a bug report.\n\nUse the Android Studio Layout Inspector with an XR app\n------------------------------------------------------\n\nOnce you have started building your spatial panels and orbiters, you can inspect\nyour layout with the Android Studio Layout Inspector. If you are unfamiliar with\nthe Layout Inspector, see our [guide](/studio/debug/layout-inspector) on layout debugging.\n\nFollow these steps to use the Layout Inspector with your Android XR app:\n\n1. With your project open in Android Studio, ensure that the embedded Layout Inspector is disabled (uncheck the option and restart Android Studio).\n2. Run your app.\n3. Once the application deployment has completed, choose **Tools \\\u003e Layout\n Inspector**.\n\nThis Layout Inspector will open in an embedded window. After a few seconds, the\npreview displays on the left and the component tree displays on the right.\nOrbiters and panels appear as separate objects beneath your main content.\n\nNow, you can interact with your app in the emulator. If you want to inspect any\ncomponent, click it on the preview or in the component tree.\n\nYou can see the component attributes by clicking the attributes tab on the right\ncorner.\n\n| **Preview:** Currently, the layout inspector doesn't display depth on the z axis.\n\nEnable Usage Statistics to help improve Android Studio for XR\n-------------------------------------------------------------\n\nConsider enabling usage statistics and sending feedback to help us improve these\ntools. Because this is a canary version of Android Studio, many of these\nfeatures are still under development.\n\nClick **Settings \\\u003e Appearance \\& Behavior \\\u003e System Settings \\\u003e Data Sharing** , and\nensure that **Send usage statistics to google** is selected.\n\n*** ** * ** ***\n\nOpenXR™ and the OpenXR logo are trademarks owned\nby The Khronos Group Inc. and are registered as a trademark in China,\nthe European Union, Japan and the United Kingdom."]]