Dear friends, setting up your computer to compile for the Oculus Standalone is a nasty and terrible experience. Here’s all the things you need to do to make your life easier:
FIRST:
Download & Install Android Studio 3.5.3: download
Inside Android Studio, in the SDK Platform section, download the sdk for Android 9.0, API Level 28.
Inside Android Studio, in the SDK Platform Tools, download the Android SDK Build tools Version 29. Anything greater than Version 29 as of this writing, prevents successful compilation in Unreal Engine 4.26.2
Download JDK17 (download) or JDK 8(download). Someone claimed that JDK 8 helps with successful compilation, but I’m not sure.
Download and Install Oculus ADB drivers: download Unzip it, right-click android_winusb.inf, and click install.
SECOND:
Add the above to the environmental variables on your PC.
If JAVA_HOME doesn’t exist… create a new variable, call it JAVA_HOME and point it to “YOUR_DIRECTORY_HERE\Java\jdk-YOUR_VERSION_HERE”
If JRE_HOME doesn’t exist… create a new variable, call it JRE_HOME and point it to “YOUR_DIRECTORY_HERE\Android\Android Studio\jre”
If ANDROID_HOME doesn’t exist… create a new variable, call it ANDROID_HOME and point it to “YOUR_DIRECTORY_HERE\Android\Sdk”
If NDK_ROOT doesn’t exist… create a new variable, call it NDK_ROOT and point it to “YOUR_DIRECTORY_HERE\Android\Sdk\ndk\21.1.6352462”
Go to CMD and type in “adb” if it says you don’t have it… edit the PATH variable and add a directory: “YOUR_DIRECTORY_HERE\Android\Sdk/platform-tools\”
THIRD
Go to your phone when your headset is on and on the same wifi, and turn on developer mode.
Plug headset into PC, put it on and click on the menu that says “always allow PC to access headset”
go to CMD and type in “adb devices” and confirm that the Oculus Quest 2 is visible.
FOURTH
Launch Unreal Engine, go to project launcher and see if it detects your headset there.
Make sure your OculusVR plugin is enabled.
Go to the Project Settings and start changing settings:
go to packaging > list of maps to include in a packaged build > select maps that you want to build with
go to packaging > cook only maps > TRUE
go to packaging > exclude editor content when cooking > TRUE
go to supported platforms > Android > TRUE
go to Target Hardware > Optimize settings for > Mobile/Tablet | Scaleable 2D or 3D
go to Rendering > Mobile MSAA > 4x MSAA
go to Rendering > Disable vertex fogging in mobile shaders > TRUE
go to Rendering > Reflection Capture Resolution > 128 (change to 64 to improve performance)
go to Rendering > Forward Shading > TRUE
go to Rendering > Vertex Fogging for Opaque > TRUE
go to Rendering > Anti-Aliasing method > MSAA
go to Rendering > Instanced Stero > TRUE
go to Rendering > Mobile HDR > TRUE (FALSE for Quest 1 and GO)
go to Android > configure now and accept SDK license.
go to Android >Package game data inside .apk > TRUE
go to Android >Support Armv7 > TRUE
go to Android >Support Vulkan > TRUE
Everything else in the Build should be false. Do not support OpenGL and Vulkan simultaneously
go to Android >Package for Oculus Mobile Devices > add array element and choose your headset that you’re packaging for
go to Android > Oculus Signature Files from Distribution APK > TRUE
go to Android SDK > Location of Android SDK > i.e. C:/Users/matthew/AppData/Local/Android/Sdk
go to Android SDK > Location of NDK > i.e C:/Users/matthew/AppData/Local/Android/Sdk/ndk/21.1.6352462
go to Android SDK > Location of JAVA > i.e. C:/Program Files/Java/jdk1.8.0_202
go to Android SDK > SDK API Level > LATEST
go to Android SDK > NDK API Level > LATEST
go to Oculus VR, turn everything to TRUE
go to Oculus VR > Color Space > QUEST
LAST
compile through project launcher for ANDROID_ASTC, by the book, to the headset you have connected to your PC.