Testing your app on a real device prior to releasing it to users is an imperative step in software development lifecycle. This topic describes how to set up your Oculus device for testing and debugging your app on Oculus device.
Depending on the Oculus device, you can choose different ways to test your app. In general, connecting your device through USB is the basic and mandatory way to test your app on the Oculus device. In addition, you can optionally use Android Debug Bridge (ADB) to perform advanced-level testing and debugging activities for Android apps.
You must set your Oculus device into developer mode and connect it to your computer with a USB cable before you can run your app to test its functionality, layout, and overall user experience.
To set your Oculus device into developer mode:
Accept Allow USB Debugging and Always allow from this computer when prompted to on the device.
In the Run Device list, you should be able to view the Oculus device.
The scene loads in the connected Oculus device.
Android Debug Bridge (ADB) is a command-line utility that lets you perform a variety of actions such as install and debug apps, copy files, or run several shell commands on the Oculus device. It is included with the Android SDK tools installation and located inside the
If you’re developing on Windows, download the OEM USB driver. If you’re developing on macOS, skip to step 3 as you don’t need any additional USB drivers.
a. Extract the oculus-adb-driver-2.0 zip file, go to the
/oculus-go-adb-driver-2.0/usb_driver/ folder, and double-click the
Open Terminal on your computer and run the following command to check the connected device:
List of devices attached 1PASH9BB939351 device
When you build an app in Unity, it creates a .apk file, which is an Android executable file. You can install the apk manually on your Oculus device for testing and debugging purposes by using ADB commands.
Open Terminal on your computer and run the following command to install the app:
adb install -r <build_path>
adb install -r /Users/username/Unity-Sample-Projects/ballgame/playgame.apk
Performing Streamed Install Success
ADB is a versatile tool that lets you perform several debugging activities. There are a variety of adb commands that you can run on your Oculus device based on your requirement. For more information about learning ADB in detail and using its commands, go to Android Debug Bridge in the Android documentation.
Computer is unable to detect the Oculus device.
There can be many reasons why your computer is unable to detect the Oculus device. To begin with:
Terminal returns an error:
adb command not found.
adbis correctly installed. Go to
/Android/SDK/platform-tools/folder and check for the
adbtool. If the tool is missing, download the standalone Android SDK Platform-Tools package.
/Android/SDK/platform-tools/folder by prefixing
adbcommand. For example, instead of
adb devices, use
If you have already set up your Oculus Rift for regular use, you are ready to begin Unity development.
While you build your app, Unity prompts you to provide location for the build, from where you can access the app for testing purposes. Considering you want to test your app, which is pending Oculus review, you must allow unknown sources on your device.