This guide introduces the Android Studio IDE and review its basic relevant features.
When you first launch Android Studio after initial setup, you will be presented with a Welcome screen. Select Import project and point it at our root Gradle project.
You may import any build.gradle project in any of the Mobile SDK VrSamples directories, and Android Studio will automatically import the required dependencies without bringing in all of the samples.
We recommend changing the Project Overview from the default Android to Project, which provides a good overview of the entire directory structure, with imported project directories shown in bold.
After importing your project, verify that the SDK and NDK locations are configured properly in File > Project Structure..., or your build will fail.
You may build and run your application on your device directly from Android Studio. This will compile your project, build the APK, copy it to the phone via USB/Wi-Fi, and prepare it for launching.
If your phone is set to Developer Mode (see Developer Mode for instructions), your application will play without being inserted into your Gear VR headset. Otherwise, when the process completes you will be prompted to insert your mobile device into the headset to launch the application.
Make sure you have followed the configuration steps in the Mobile SDK Setup Guide to ensure your device is configured appropriately. Applications must be signed with an Oculus Signature File (osig) in order to run (see Application Signing for more information).
Select the target configuration you wish to build before building by selecting Edit Configurations… in the project dropdown menu in the Android Studio toolbar.
Immediately to the right of the project dropdown, you will see Run and Debug icons. Click on either icon to build and run your project.
After clicking on Run or Debug, the Choose Device dialog window will open. This is usually set to an emulator by default. Select Choose a running device and select the appropriate option.
At this point, the phone may prompt you to enable USB debugging. If the device is not connected and there is no prompt, try the following:
This should get the prompt to show up.
You may also build and clean your project without running it by using the Build menu.
If you edit a *.gradle file or install an update to the Oculus Mobile SDK which includes updated Gradle Projects, you must Gradle Sync to update the Android Studio project files.
Click on Sync Project with Gradle Files in the Android Studio toolbar as shown.