Digital Arts & Sciences Programs | Digital Worlds Institute | University of Florida
The J4Q project demonstrates how to create Virtual Reality apps for Meta Quest headsets as Native Android applications using Java in Android Studio. This project can be used as a setup for learning how to develop from scratch a basic game engine for Virtual Reality in Java. It can also be used along with a structured curriculum for teaching various topics related to game engine development such as: 3D Transformations using Matrices and Vectors, 3D geometry using triangular mesh, Animation loop, Shaders using GLSL, Controller input, Vibration feedback, and many other topics.
The following instructions will guide you step by step on how to setup and run J4Q in your system. The instructions include details for the following steps:
- Install all the required software.
- Configure your headset.
- Open in Android studio the project file:
J4Q_46.0/JavaForQuest_Demo/Projects/Android/build.gradle
You need to install the following software to be able to compile Android software for Meta Quest headsets:
- The latest version of Android Studio: https://developer.android.com/studio
- Open the SDK Manager of Android Studio and install the SDK Platform 8.0 (Oreo) API Level 26
- In the SDK Manager of Android Studio, go to the SDK Tools tab and check the box
Show Package Detailsand install: 1) NDK (21.0.6113669), 2) CMake (3.22.1)
- Update the headset to the latest firmware and software by going to Quick Settings (where the time and battery status is shown) -> Settings -> Software Update
- Enable Developer Mode by using the Meta Quest app
- Open in Android studio the project file:
J4Q_46.0/JavaForQuest_Demo/Projects/Android/build.gradle - If there errors during the build process, follow our troubleshooting guide at the end of this document.
- Connect your Quest headset to your development computer using the charging cable.
- In the headset accept the pop-up permission dialog.
- When the name of your headset device appears in the device list in the toolbar of Android Studio, click on the Run button to compile the project and install it on your headset.
- Test the J4Q Demo app in your headset.
- In general, you can find and run the app in your Quest headset in your Library in the category 'Unknown Sources'.
- Android Studio Dolphin 2021.3.1 Patch 1
- Android SDK Platform 8.0 (Oreo) API Level 26
- Gradle 6.1.1
- NDK 21.0.6113669
- CMake 3.22.1
- Development Systems: MacOS 12.5 Monterey (M2 chip), MacOS 11.7.1 Big Sur (Intel chip), Windows 10, Windows 11
- Meta Quest 1 & 2 (Testing systems)
- Go to File -> Project Structure -> SDK Location and download NDK or select one from the list (if any).
- After that, the file
JavaForQuest_Demo/Projects/Android/local.propertieswill automatically be generated with the parameterssdk.dirandndk.dir. - If the file does not contain
ndk.diryou can edit the text and append a line with the path to your NDK. For example:ndk.dir=...some path.../Android/sdk/ndk/21.0.6113669. - Then, copy the
local.propertiesfile and paste it in theJ4Q_46.0folder. - Finally, try again by clicking on the "try again" button on top of the text editor, when viewing the local.properties file.
Execution failed for task ':JavaForQuest_Demo:Projects:Android:genDebugKeystore'. Process 'command python3' finished with non-zero exit value 1
- This error appears if the file
JavaForQuest_Demo/Projects/Android/android.debug.keystoreis missing, possibly because it was automatically removed when performing Build -> Clean Project or Build -> Rebuild Project. - An easy way to fix this is to copy the file
JavaForQuest_Demo/Projects/Android/keystore/android.debug.keystoreinto the folderJavaForQuest_Demo\Projects\Androidand then re-run.
Otherwise, a more lengthy solution is to open a command line terminal and go into the folder JavaForQuest_Demo\Projects\Android and run the command python3 ../../../bin/scripts/build/ovrbuild_keystore.py. This step requires prior installation of python3 as well as setting the system variables ANDROID_NDK_HOME and ANDROID_HOME.
In MacOS it is helpful if you set Android Studio as a Developer Tool.
- To do that, first enable Developer Mode by opening the Terminal and typing
spctl developer-mode enable-terminal. - Then in System Preferences go to Security & Privacy and in the Privacy Tab, go to the option Developer Tools and add Android Studio.