Set up the Jetpack XR SDK

Applicable XR devices
This guidance helps you build experiences for these types of XR devices.
XR Headsets
Wired XR Glasses
AI Glasses

Before you can start building, you need to set up the Jetpack XR SDK. Follow the steps in each section to set up your development environment with the SDK.

Check Android SDK compatibility

The Jetpack XR SDK requires your app to use an Android minSdk of 24 and a compileSdk of 34 or higher.

Add library dependencies

The dependencies that your app requires depend on the types of experiences and XR devices that you are building for. See the following sections for more information about adding the dependencies for your app.

Add library dependencies for immersive experiences (XR headsets and XR glasses)

First, see the following reference guides to understand necessary dependencies and compatibility issues for each of the required libraries:

Then, add the necessary dependencies to your app's build.gradle.kts file:

Groovy

dependencies {
    implementation "androidx.xr.runtime:runtime:1.0.0-alpha09"
    implementation "androidx.xr.scenecore:scenecore:1.0.0-alpha10"
    implementation "androidx.xr.compose:compose:1.0.0-alpha09"
    implementation "androidx.xr.compose.material3:material3:1.0.0-alpha13"
    implementation "androidx.xr.arcore:arcore:1.0.0-alpha09"

    // For compatibility with guava, use these dependencies:
    implementation "androidx.xr.arcore:arcore-guava:1.0.0-alpha09"
    implementation "androidx.xr.runtime:runtime-guava:1.0.0-alpha09"
    implementation "androidx.xr.scenecore:scenecore-guava:1.0.0-alpha10"

    // For compatibility with rxjava3, use these dependencies:
    implementation "androidx.xr.arcore:arcore-rxjava3:1.0.0-alpha09"
    implementation "androidx.xr.runtime:runtime-rxjava3:1.0.0-alpha09"
}

Kotlin

dependencies {
    implementation("androidx.xr.runtime:runtime:1.0.0-alpha09")
    implementation("androidx.xr.scenecore:scenecore:1.0.0-alpha10")
    implementation("androidx.xr.compose:compose:1.0.0-alpha09")
    implementation("androidx.xr.compose.material3:material3:1.0.0-alpha13")
    implementation("androidx.xr.arcore:arcore:1.0.0-alpha09")

    // For compatibility with guava, use these dependencies:
    implementation("androidx.xr.arcore:arcore-guava:1.0.0-alpha09")
    implementation("androidx.xr.runtime:runtime-guava:1.0.0-alpha09")
    implementation("androidx.xr.scenecore:scenecore-guava:1.0.0-alpha10")

    // For compatibility with rxjava3, use these dependencies:
    implementation("androidx.xr.arcore:arcore-rxjava3:1.0.0-alpha09")
    implementation("androidx.xr.runtime:runtime-rxjava3:1.0.0-alpha09")
}

Enable code minification (optional)

If you want to enable code minification and obfuscation using ProGuard for your builds, you must also 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 dependencies
    compileOnly "com.android.extensions.xr:extensions-xr:1.1.0"
}

Kotlin

dependencies {
    // ... other dependencies
    compileOnly("com.android.extensions.xr:extensions-xr:1.1.0")
}

Add library dependencies for augmented experiences (AI glasses)

First, see the following reference guides to understand necessary dependencies and compatibility issues for each of the required libraries:

Then, add the necessary dependencies to your app's build.gradle.kts file:

Groovy

dependencies {
    implementation "androidx.xr.runtime:runtime:1.0.0-alpha09"
    implementation "androidx.xr.glimmer:glimmer:1.0.0-alpha02"
    implementation "androidx.xr.projected:projected:1.0.0-alpha03"
    implementation "androidx.xr.arcore:arcore:1.0.0-alpha09"
}

Kotlin

dependencies {
    implementation("androidx.xr.runtime:runtime:1.0.0-alpha09")
    implementation("androidx.xr.glimmer:glimmer:1.0.0-alpha02")
    implementation("androidx.xr.proejcted:projected:1.0.0-alpha03")
    implementation("androidx.xr.arcore:arcore:1.0.0-alpha09")
}