Unity Editor — Oculus Quest and Android: Common Errors and Solutions
Date Written: February 7th, 2021
Intro
After three years, I’m back with another episode of Unity Editor problems and solutions. Unity has evolved and so have its problems.
These are my notes from all the problems that popped up when I was trying to set up my VR project, for the Oculus Quest, with the Oculus Integration Asset. I’ve written them in order of importance.
If you have questions, find me in the comment section or on twitter https://twitter.com/LouisGameDev
Good luck!
Import Oculus Integration and read the guide from Oculus.
Understand Oculus Integration Package Components
Oculus Integration | Integration | Unity Asset Store
Go through this guide
Install Android Logcat package to the Android system logs
Indispensible tool to fix errors device-specific errors. These errors give a lot of good hints about what went wrong, usually with your build settings.
Use the 2020.1 and only 2020.1 with Oculus Integration
Do not use 2020.2.3f1
This version has many issues on the Oculus Quest, even if the build succeeded and installed. You can check them out for yourself using the Android Logcat package and filter by error.
The worst bug for me with this version is having the game rendering over native system UI
Do not use 2019.4 LTS
Oculus Integration build issues, you won’t be able to install onto the device.
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Configure project :launcher
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\build-tools\\28.0.3\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\platform-tools\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\platforms\\android-29\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\tools\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\build-tools\\28.0.3\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\platform-tools\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\platforms\\android-29\\package.xml. Probably the SDK is read-only
Exception while marshalling C:\\Program Files\\Unity\\Hub\\Editor\\2019.4.19f1\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\tools\\package.xml. Probably the SDK is read-only
> Configure project :unityLibrary
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: <http://d.android.com/r/tools/update-dependency-configurations.html>
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
OVRBundleManager:BuildDeployTransitionAPK(Boolean) (at Assets/Oculus/VR/Editor/OVRBundleManager.cs:74)
OVRBundleTool:Update() (at Assets/Oculus/VR/Editor/OVRBundleTool.cs:347)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()FAILURE: Build failed with an exception.
* Where:
Build file 'C:\\_Active Projects\\UnityProjects\\VR Toys 2019.4\\Temp\\gradleOut\\unityLibrary\\build.gradle' line: 38
* What went wrong:
A problem occurred evaluating project ':unityLibrary'.
> Could not get unknown property 'unityStreamingAssets' for object of type com.android.build.gradle.internal.dsl.AaptOptions.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 9s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
OVRBundleManager:BuildDeployTransitionAPK(Boolean) (at Assets/Oculus/VR/Editor/OVRBundleManager.cs:74)
OVRBundleTool:Update() (at Assets/Oculus/VR/Editor/OVRBundleTool.cs:347)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()FAILURE: Build failed with an exception.
* Where:
Build file 'C:\\_Active Projects\\UnityProjects\\VR Toys 2019.4\\Temp\\gradleOut\\unityLibrary\\build.gradle' line: 38
* What went wrong:
A problem occurred evaluating project ':unityLibrary'.
> Could not get unknown property 'unityStreamingAssets' for object of type com.android.build.gradle.internal.dsl.AaptOptions.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 9s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
OVRBundleManager:BuildDeployTransitionAPK(Boolean) (at Assets/Oculus/VR/Editor/OVRBundleManager.cs:74)
OVRBundleTool:Update() (at Assets/Oculus/VR/Editor/OVRBundleTool.cs:347)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Use Oculus Lint-tool From Oculus Integration to automatically find issues
An extremely useful tool that finds common issues and fixes some of them automatically for you.
For rapid building and deploying, use OVR Scene Quick Preview
Your game will be wrapped in a launcher which loads your scene as an asset bundle. This technique avoids rebuilding the entire application for just for asset changes; when there are no script changes, simply use “Build and Deploy Scene(s)” to deploy Scene and asset changes. This tool will build your scene and its assets into an asset bundle, then deploy it to the device for the launcher to load in real-time.
It also includes useful features like launch and uninstall.
SDK Manager: Install Missing Android Target SDK Version
For anyone that finds this and is having problems with a Unity install not having an Android SDK when trying to build (I’m on 2020) here’s a potential fix I wish I would have found sooner:
windows:
1. run CMD (command prompt) as an administrator: *Right-Click “run as administrator”
2. navigate to the Android SDK Manager installed by Unity:
cd C:\\Program Files\\Unity\\Hub\\Editor\\[UNITYVERSION]\\Editor\\Data\\PlaybackEngines\\AndroidPlayer\\SDK\\tools\\bin
3. I don’t know if you need to run the SDK here first or not, I did:
sdkmanager.bat
4. Run this code, adding the API version you want to install:
sdkmanager "platform-tools" "platforms;android-26"
5. Agree to terms: Y
Your missing SDK will now be installed, close and restart Unity if you had it open. You should now be able to do your build.
source: https://forum.unity.com/threads/android-sdk-manager-from-within-unity.764507/
Black screen with floating white windows saying “Failed to Get Scene Info Data”
In Assets/Oculus/VR/Editor/OVRBundleManager.cs, on line 453 it detects that no bundle has been previously deployed by comparing the error message to the string “does not exist”. But as reported in the OP the error message is “No such file or directory”.
I changed line 453 to instead read:
if (output.Contains("does not exist") || output.Contains("No such file or directory"))
then, press “Build and Deploy Scene(s)” to deploy the scene to the device.
And now it works!
Oculus Quick Build & Deploy Error:
DeploymentOperationFailedException: No activity in the manifest with action MAIN and category LAUNCHER. Try launching the application manually on the device.
Edit Plugins/Android/AndroidManifest.xml Replace INFO with LAUNCHER worked
<intent-filter>
<!-- changed from android.intent.action.INFO-->
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
source: https://forum.unity.com/threads/unityexception-unable-to-start-activity.382138/#post-6587854
Despite Oculus Store App submission requiring ARM64, during development, you should use ARM32 with Mono — for short built-time.
ARM64 is only supported by IL2CPP, and IL2CPP build time is orders of magnitude slower than ARM32 with Mono.
Do not close the Oculus Windows App, will close Unity Editor!!
why? no idea.
Remember to enable Oculus Plugin in XR Plug-in Management, specifically, for the Android build!
Might forget and it seems neither Unity nor Oculus Integration will remind you.
Use Oculus Cast To Stream Oculus Quest onto PC
https://www.oculus.com/casting
Useful if you’re trying to demo something really quickly, say through Discord.
Do not forget to add your new scene into the build index
easy to forget, especially when you’re deep in this rabbit hole.
Switch Unity Build Platform to Android
Oculus Hands options will be missing in OVRManager if the platform isn’t Android. Oculus Hands tutorial forgets to mention this.