Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best sample app for Oculus development with Android Studio?

Can anybody recommend a working Android Studio sample app that I can use for Oculus Quest 2, preferably with good documentation? I am looking for something I can build and run to start playing with their OpenXR Mobile SDK.

I am on an Intel Macbook Pro running macOS Big Sur, and I tried with the latest stable Android Studio release (Arctic Fox).

I have tried two different samples so far:

  1. VrSamples/VrCubeworld_Framework - from the official Oculus docs:
  • Android Development Software Setup
  • Getting Started with Oculus Native Samples: Import Gradle Project

After following all the steps, I keep hitting this error:

NDK not configured. Download it with SDK manager. Preferred NDK version is '21.0.6113669'. 

I'm convinced my NDK is installed:

ndk_installed

ndk_setings

I believe I've tried every workaround listed in the popular Stackoverflow question, and the linked Google issue.

  1. hello_xr - a comment on the Oculus Forum links to this helpful blog post with more detailed instructions than the official Oculus docs. Unfortunately, after following those, I hit this build error:
C/C++: /Users/dj/Code/OpenXR-SDK-Source/src/CMakeLists.txt debug|armeabi-v7a : CMake Error at /Users/dj/Code/OpenXR-SDK-Source/src/version.cmake:25 (file):   
  file STRINGS file  
  "/Users/dj/Code/OpenXR-SDK-Source/src/include/openxr/openxr.h" cannot be read. 
Call Stack (most recent call first):   
  CMakeLists.txt:318 (include)

There doesn't appear to be an include folder under src, and there is no openxr.h in the top level include/openxr folder.

UPDATE: At Jherico's suggestion, I downloaded Oculus OpenXR Mobile SDK v1.0.13 and OpenXR-SDK-Source release-1.0.13, and followed the instructions again to exactly match the versions used in the blog post, and ultimately I did get it working!

I created https://github.com/daj/OculusHelloXR to snapshot my working Android Studio project with all its dependencies, with individual commits for each step that I followed (I had to make a couple of changes to steps in the blog post to get it working).

I wrote everything up in this blog post: https://daj.medium.com/oculus-vr-for-android-developers-a38134c759b0

like image 521
Dan J Avatar asked Feb 02 '26 10:02

Dan J


1 Answers

The blog post instructions are likely out of date, since they're from April and the most recent version of the OpenXR SDK has it's own new build.gradle file for hello_xr that was added in 1.0.20 in October.

If you want to go by the blog post, I'd suggest that after you check out the OpenXR-SDK-Source repository, you then run git checkout release-1.0.14 since that would be the version that the blog post was written against.

Alternatively, you can just ignore the blog post and try importing the build.gradle project directly into Android Studio (basically following the "Import Gradle Project" steps you linked to, but importing hello_xr from the current version of the OpenXR-SDK-Source project instead) and try seeing it that builds.

If you're still getting NDK errors you might try explicitly setting the ANDROID_NDK_ROOT environment variable, and make sure it's visible to your build process.

like image 143
Jherico Avatar answered Feb 04 '26 01:02

Jherico



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!