How to fix XR_ERROR_RUNTIME_UNAVAILABLE in android?

Hello guys,
I am trying to run open XR hello demo in my android studio but facing difficulties to fix some paths.
This command i used to build:

-DCMAKE_BUILD_TYPE=Debug 
-DANDROID=ON 
-DJAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
-DANDROID_NDK=$ANDROID_NDK 
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake 
-DANDROID_PLATFORM=android-26 
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON 
-DHIDAPI_INCLUDE_DIR=/usr/include/hidapi 
-Dbluetooth_INCLUDE_DIR=/usr/include/bluetooth/bluetooth.h 
-DOPENHMD_INCLUDE_DIR=/usr/include/openhmd
-DXRT_FEATURE_STEAMVR_PLUGIN=OFF 
-G "Unix Makefiles"

I am able to build it successfully and then getting error in logcat with message "XrResult failure [XR_ERROR_RUNTIME_UNAVAILABLE]"

Here is full log:

OpenXR-Loader org…onos.openxr.hello_xr.opengles E Could access neither the installable nor system runtime broker.
OpenXR-Loader org…onos.openxr.hello_xr.opengles E Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeManifestFile::FindManifestFiles - failed to determine active runtime file path for this environment
OpenXR-Loader org…onos.openxr.hello_xr.opengles E Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntimes - unknown error
OpenXR-Loader org…onos.openxr.hello_xr.opengles E Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : RuntimeInterface::LoadRuntimes - failed to load a runtime
OpenXR-Loader org…onos.openxr.hello_xr.opengles E Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Failed to find default runtime with RuntimeInterface::LoadRuntime()
OpenXR-Loader org…onos.openxr.hello_xr.opengles E Error [GENERAL | xrEnumerateInstanceExtensionProperties | OpenXR-Loader] : Failed querying extension properties
hello_xr org…onos.openxr.hello_xr.opengles E [07:34:15.492][Error ] XrResult failure [XR_ERROR_RUNTIME_UNAVAILABLE]
Origin: xrEnumerateInstanceExtensionProperties(layerName, 0, &instanceExtensionCount, nullptr)
Source: /home/dk/Ravi/OpenXrDemos/OpenXR-SDK-Source/src/tests/hello_xr/openxr_program.cpp:133

Please help how can i fix this error ?

What device are you running it on? Does it have an OpenXR runtime installed?

These sound like cmake arguments for building monado. You don’t need those to build the OpenXR SDK/hello_xr. (they shouldn’t cause problems though)

Because you didn’t mention it: Devices that come with a runtime already in their system like Quest, Pico, will usually come with a system installed broker and OpenXR apks should just work.

For user-installed runtimes like for example Monado on android phones, you also have to install the broker form https://play.google.com/store/apps/details?id=org.khronos.openxr.runtime_broker or
Releases · Monado / Utilities / openxr-android-broker · GitLab, start the broker app and select the runtime.

1 Like