cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Getting hello_xr running through android studio

timewizzard
Honored Guest

Hi, I tried following the tutorial for hello_xr on the website. However, whenever I try building I get errors. I have checked multiple times to make sure I follow the instructions exactly, but it keeps happening. I have attached the error codes. 

 

  1. CMake Error at src/api_layers/CMakeLists.txt:75 (add_library): Target "XrApiLayer_api_dump" links to target "OpenXR::headers" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/api_layers/CMakeLists.txt:143 (add_library): Target "XrApiLayer_core_validation" links to target "OpenXR::headers" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/tests/c_compile_test/CMakeLists.txt:19 (add_library): Target "openxr_c_compile_test" links to target "OpenXR::openxr_loader" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/tests/hello_xr/CMakeLists.txt:26 (add_library): Target "hello_xr" links to target "OpenXR::openxr_loader" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Error at src/tests/list_json/CMakeLists.txt:22 (add_library): Target "openxr_runtime_list_json" links to target "OpenXR::openxr_loader" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? CMake Generate step failed. Build files cannot be regenerated correctly.
8 REPLIES 8

hamy.ly.9085790
Honored Guest

Bumping this. Walking through the tutorial and got the exact same problem

grosssoftware
Honored Guest

Same.

grosssoftware
Honored Guest

I found a solution to my issue. I had cloned the OpenXR-SDK-Source repo and so had the latest code. Changes made in June 2023 are incompatible with the hello_xr app build directions hereThis bug describes the problem and includes a link to a forked version with some reversions in a few CMakeList.txt files that mostly fix it. In addition, I had to remove "add_subdirectory(list_json)" from src/tests/CMakeList.txt to prevent another error. After that, I was able to build in Android Studio and run on my Quest 3.

slachz
Explorer

The release note for the current OpenXR SDK version (59.0) states as known issues :

  • Sample apps won't build with Android Studio Chipmunk 2021.2.1 or newer. Please use an older version for now.
  • Sample apps won't build with NDK newer than version 26.0.10792818. Please use an older version for now.

src : https://developer.oculus.com/downloads/package/oculus-openxr-mobile-sdk/

So presumably we should use NDK version 26.0.x (or is it 25.2.x ? the sentence "use an older version" is confusing with respect to "not working with newer than"), and Android Studio Bumblebee 2021.1.1 (found via the archive here : https://developer.android.com/studio/archive).

adtewa
Honored Guest

Hi. It is possible to make it work with the latest Android Studio, 59.0 OpenXR SDK, latest original hello_xr code and the changes given on the oculus developer page. Only a few tinkering needed with the code, that are responses to cmake errors. But I won't ruin the fun finding them. ^^
Also you need to open the hello_xr folder as project in Android Studio. But only do this after you managed to build it with gradle, It makes a quite strange directory structure for the project. After it has run gradle build automatically and your headset is connected, you just need to run it.

(I tried with Quest 2. Built on Mac)

brijeshsk
Honored Guest

It looks like the cmake issue (https://github.com/KhronosGroup/OpenXR-SDK-Source/issues/419) is fixed in the latest OpenXR SDK release (1.0.32), but the same error still exists when following instructions on the Meta Quest page. Anyone have any insights?


Target "openxr_c_compile_test" links to target "OpenXR::openxr_loader" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

kevin_asu
Honored Guest

I was able to build easily using this forked branch: https://github.com/pfontain/OpenXR-SDK-Source/tree/release-1.0.32-quest
Just need to set the oculus sdk path in the local.properties file:

oculus.openxr.mobile.sdk.path=C:/oculusdevel/ovr_openxr_mobile_sdk_60.0

 
Currently, it's only a couple commits behind KhronosGroup/OpenXR-SDK-Source:main, but can probably be rebased if needed.

I can confirm, this also worked for me using the latest Android Studio.