4

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:

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

Dan J
  • 25,433
  • 17
  • 100
  • 173

1 Answers1

1

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.

Jherico
  • 28,584
  • 8
  • 61
  • 87
  • 2
    Good idea to try the exact releases that they used in the blog post. When I used v1.0.13 of the Oculus OpenXR Mobile SDK *and* OpenXR-SDK-Source release-1.0.13, then eventually I got it working. Thanks for the idea! BTW, I did have `ANDROID_NDK_ROOT` set up, but that didn't seem to help (though maybe I have a mistake in making it visible to my build process). – Dan J Nov 18 '21 at 02:12
  • 2
    In case it helps others, I have now collected together all the steps into a single repo, with individual commits for each step that I followed: https://github.com/daj/OculusHelloXR – Dan J Nov 18 '21 at 03:26