Develop

Horizon OS Java Software Development Kit Integration Guide

Updated: May 13, 2026
The Horizon OS Java Software Development Kit (JSDK) provides access to Horizon OS system APIs. These APIs are presented in Java, but they can be used from other languages which can interact with Java, such as Kotlin, C++, and Rust. You can use the JSDK alone or alongside other Meta SDKs.
The following sections explain how to integrate the JSDK into an app project using Android Studio.

Prerequisites

  • Android Studio 2025.2.* or newer
  • Android Gradle Plugin 8.9.0 or higher
  • Gradle 8.13 or higher
  • A physical Meta Quest device running Horizon OS
Alternative Android Studio configurations may function, but are not officially supported.
These instructions assume your project uses the Kotlin DSL (build.gradle.kts) for the Build configuration language option.

Project Setup

The JSDK is provided as an Android Archive (AAR) package containing API stubs and Javadoc documentation. Since the JSDK is an operating system library, add the JSDK AAR to your app as a build-time-only dependency. Avoid packaging it into your app’s build. The full API implementations are supplied to your app by Horizon OS at runtime.
Add the JSDK AAR as a build dependency using one of these methods:
  • Option A: Gradle dependency (recommended): Configure your project to download the JSDK AAR from Maven Central.
  • Option B: Manual integration: Download the JSDK AAR manually and add it to your project using Android Studio’s Project Structure tool or by directly modifying your project’s Gradle configuration files.

Option A: Gradle Dependency

This option configures the project to fetch the JSDK from Maven Central automatically.

Step A1: Add Maven Central Repository

In your project’s settings.gradle.kts file, ensure mavenCentral() appears under dependencyResolutionManagement.repositories:
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()   // Required for JSDK
    }
}

Step A2: Add JSDK to Library Catalog

In gradle/libs.versions.toml, add the JSDK entry under [libraries]:
[libraries]
horizonos-jdk = { group = "com.meta.horizonos", name = "horizon-os-jdk", version = "204" }
Replace 204 with the JSDK version you wish to use.

Step A3: Add JSDK Dependency to Modules

In each module needing access to JSDK APIs, add a compileOnly dependency in the module’s build.gradle.kts file (for example, app/build.gradle.kts):
dependencies {
    compileOnly(libs.horizonos.jdk)
}

Option B: Manual Integration

Use this method if you work offline or do not want to use Maven Central.

Step B1: Download JSDK AAR and Add to Project

Download the latest JSDK AAR from the official distribution page, then place it into your project’s directory structure.
For example, in a project whose main module is named app, the AAR could be added to the project under <project root>/app/lib/.

Step B2: Add JSDK Dependency

Add the JSDK as a dependency using one of these options:
  • Option 1: Use Android Studio’s Project Structure tool
  • Option 2: Modify Gradle build configuration files manually

Option 1: Using Android Studio Project Structure

This section is based on recent Android Studio versions, such as Otter 2, on macOS. User interface and menu options may vary depending on your Android Studio version and operating system.
Repeat these steps for each module from which you want to access JSDK.
  1. Open File > Project Structure.
  2. Select the Dependencies tab.
  3. Under Modules, select the module from which you want to invoke JSDK APIs (for example, app).
  4. Click the + button in the Declared Dependencies section.
  5. Select JAR/AAR Dependency.
  6. In the dialog’s Step 1 field, enter the relative path to the JSDK AAR file. For example, if your module is named app and the AAR is under <project root>/app/lib, enter lib/horizon-os-jdk-v204.aar.
  7. In the dialog’s Step 2 field, manually enter compileOnly. This option may not appear by default in the dropdown menu but can be selected from the autocomplete once you start typing.
  8. Click OK to confirm.

Option 2: Modify Gradle Build Files Manually

For each module from which you want to invoke JSDK APIs, open the module’s build.gradle.kts file (for example, <project root>/app/build.gradle.kts).
In the dependencies section, add a compileOnly entry for the AAR, for example:
compileOnly(files("lib/horizon-os-jdk-v204.aar"))
Run Gradle Sync to apply the change.

Configuring your app’s manifest

To access JSDK’s APIs, your app must declare the uses-horizonos-sdk element in its manifest. See the documentation on Horizon OS SDK versioning for more information.

Using the JSDK

After adding the JSDK to the relevant project module(s), import the API symbols you want to use.
The Kotlin example below shows how to import and call the API to get the current Horizon OS SDK version on a Quest device:
import horizonos.os.Build
...
val sdkVersion: Int = Build.HorizonOsSdk.getVersion()
The JSDK generally follows Android SDK design patterns. APIs appear in these forms:

Java is a registered trademark of Oracle and/or its affiliates.