Stay organized with collections
Save and categorize content based on your preferences.
This guide provides instructions for creating an Android XR application using
the Jetpack XR SDK. It covers essential dependencies and project setup in
Android Studio for building immersive XR experiences.
Compatibility
The Jetpack XR SDK requires a minSdk of 24 and must compile to SDK 34 or
higher.
Add dependencies
See the following reference guides to understand necessary dependencies and
compatibility issues for each of the libraries in the Jetpack XR SDK:
Then, add the necessary dependencies to your app's build.gradle.kts file:
Groovy
dependencies{implementation"androidx.xr.runtime:runtime:1.0.0-alpha05"implementation"androidx.xr.scenecore:scenecore:1.0.0-alpha06"implementation"androidx.xr.compose:compose:1.0.0-alpha06"implementation"androidx.xr.compose.material3:material3:1.0.0-alpha11"implementation"androidx.xr.arcore:arcore:1.0.0-alpha05"// For compatibility with guava, use these dependencies:implementation"androidx.xr.arcore:arcore-guava:1.0.0-alpha05"implementation"androidx.xr.runtime:runtime-guava:1.0.0-alpha05"implementation"androidx.xr.scenecore:scenecore-guava:1.0.0-alpha06"// For compatibility with rxjava3, use these dependencies:implementation"androidx.xr.arcore:arcore-rxjava3:1.0.0-alpha05"implementation"androidx.xr.runtime:runtime-rxjava3:1.0.0-alpha05"}
Kotlin
dependencies{implementation("androidx.xr.runtime:runtime:1.0.0-alpha05")implementation("androidx.xr.scenecore:scenecore:1.0.0-alpha06")implementation("androidx.xr.compose:compose:1.0.0-alpha06")implementation("androidx.xr.compose.material3:material3:1.0.0-alpha11")implementation("androidx.xr.arcore:arcore:1.0.0-alpha05")// For compatibility with guava, use these dependencies:implementation("androidx.xr.arcore:arcore-guava:1.0.0-alpha05")implementation("androidx.xr.runtime:runtime-guava:1.0.0-alpha05")implementation("androidx.xr.scenecore:scenecore-guava:1.0.0-alpha06")// For compatibility with rxjava3, use these dependencies:implementation("androidx.xr.arcore:arcore-rxjava3:1.0.0-alpha05")implementation("androidx.xr.runtime:runtime-rxjava3:1.0.0-alpha05")}
If you want to enable code minification and obfuscation using ProGuard for your
builds, you must add a dependency on the Android Extensions for XR library. This
is required for projects using Jetpack XR alpha05 or newer.
Add the following compileOnly dependency to your module's build.gradle.kts
file:
Groovy
dependencies{// ... other dependenciescompileOnly"com.android.extensions.xr:extensions-xr:1.0.0"}
Create a new app in Android Studio using the Basic Headset Activity Template
To create a new project that includes Jetpack Compose for XR, proceed as
follows:
If you're in the Welcome to Android Studio window, click Start a new
Android Studio project. If you already have an Android Studio project
open, select File > New from the menu bar.
Select XR from the Template options and then Basic Headset
Activity.
In the Configure your project window, do the following:
Set the Application name.
Choose the Project location for your sample.
Click Finish.
Verify that the project's build.gradle file is configured correctly, as
described in Gradle properties files.
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 2025-08-27 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 2025-08-27 UTC."],[],[],null,["This guide provides instructions for creating an Android XR application using\nthe Jetpack XR SDK. It covers essential dependencies and project setup in\nAndroid Studio for building immersive XR experiences.\n\nCompatibility\n\nThe Jetpack XR SDK requires a `minSdk` of 24 and must compile to SDK 34 or\nhigher.\n\nAdd dependencies\n\nSee the following reference guides to understand necessary dependencies and\ncompatibility issues for each of the libraries in the Jetpack XR SDK:\n\n- [XR Runtime](/jetpack/androidx/releases/xr-runtime)\n- [Jetpack SceneCore](/jetpack/androidx/releases/xr-scenecore)\n- [Jetpack Compose for XR](/jetpack/androidx/releases/xr-compose)\n- [Material Design for XR](/jetpack/androidx/releases/xr-compose-material3)\n- [ARCore for Jetpack XR](/jetpack/androidx/releases/xr-arcore)\n\nThen, add the necessary dependencies to your app's `build.gradle.kts` file:\n\n\nGroovy \n\n```groovy\ndependencies {\n implementation \"androidx.xr.runtime:runtime:1.0.0-alpha05\"\n implementation \"androidx.xr.scenecore:scenecore:1.0.0-alpha06\"\n implementation \"androidx.xr.compose:compose:1.0.0-alpha06\"\n implementation \"androidx.xr.compose.material3:material3:1.0.0-alpha11\"\n implementation \"androidx.xr.arcore:arcore:1.0.0-alpha05\"\n\n // For compatibility with guava, use these dependencies:\n implementation \"androidx.xr.arcore:arcore-guava:1.0.0-alpha05\"\n implementation \"androidx.xr.runtime:runtime-guava:1.0.0-alpha05\"\n implementation \"androidx.xr.scenecore:scenecore-guava:1.0.0-alpha06\"\n\n // For compatibility with rxjava3, use these dependencies:\n implementation \"androidx.xr.arcore:arcore-rxjava3:1.0.0-alpha05\"\n implementation \"androidx.xr.runtime:runtime-rxjava3:1.0.0-alpha05\"\n}\n```\n\nKotlin \n\n```kotlin\ndependencies {\n implementation(\"androidx.xr.runtime:runtime:1.0.0-alpha05\")\n implementation(\"androidx.xr.scenecore:scenecore:1.0.0-alpha06\")\n implementation(\"androidx.xr.compose:compose:1.0.0-alpha06\")\n implementation(\"androidx.xr.compose.material3:material3:1.0.0-alpha11\")\n implementation(\"androidx.xr.arcore:arcore:1.0.0-alpha05\")\n\n // For compatibility with guava, use these dependencies:\n implementation(\"androidx.xr.arcore:arcore-guava:1.0.0-alpha05\")\n implementation(\"androidx.xr.runtime:runtime-guava:1.0.0-alpha05\")\n implementation(\"androidx.xr.scenecore:scenecore-guava:1.0.0-alpha06\")\n\n // For compatibility with rxjava3, use these dependencies:\n implementation(\"androidx.xr.arcore:arcore-rxjava3:1.0.0-alpha05\")\n implementation(\"androidx.xr.runtime:runtime-rxjava3:1.0.0-alpha05\")\n}\n```\n\nSee the [Hello Android XR sample](https://github.com/android/xr-samples).\n\nEnable code minification (optional)\n\nIf you want to enable code minification and obfuscation using ProGuard for your\nbuilds, you must add a dependency on the Android Extensions for XR library. This\nis required for projects using Jetpack XR `alpha05` or newer.\n\nAdd the following `compileOnly` dependency to your module's `build.gradle.kts`\nfile:\n\n\nGroovy \n\n```groovy\ndependencies {\n // ... other dependencies\n compileOnly \"com.android.extensions.xr:extensions-xr:1.0.0\"\n}\n```\n| **Caution:** You must use `compileOnly` for this dependency. Using `implementation` or `api` will cause your app to break at runtime.\n\nCreate a new app in Android Studio using the Basic Headset Activity Template\n\nTo create a new project that includes Jetpack Compose for XR, proceed as\nfollows:\n\n1. If you're in the **Welcome to Android Studio** window, click **Start a new\n Android Studio project** . If you already have an Android Studio project open, select **File \\\u003e New** from the menu bar.\n2. Select **XR** from the **Template** options and then **Basic Headset\n Activity**.\n3. In the **Configure your project** window, do the following:\n 1. Set the **Application name**.\n 2. Choose the **Project location** for your sample.\n4. Click **Finish**.\n5. Verify that the project's build.gradle file is configured correctly, as described in [Gradle properties files](/studio/build#properties-files)."]]