This guide provides a basic configuration for using Oculus Mobilesdk in Androidstudio and Gradle, and attempts to make up for related Android studio documentation.
Migrating Eclipse Engineering to Android Studio
How to import an existing Eclipse project into Android Studio, see the instructions provided by Android: Http://developer.android.com/sdk/installing/migrate.html.
Start Oculus native example: Import Gradle Project
When you start Android Studio for the first time after you initialize the configuration, you will be presented with a welcome interface. Choose to import the project and guide it to our root Gradle project.
To facilitate we have configured the root Androidstudio project to include all our examples (they provide a shortcut to start our SDK). You can also import any compiled Gradle project under the MOBILESDK vrsamples directory, and Android Studio will automatically import requirements dependencies instead of all the examples.
Project Overview
We recommend transforming Project overview from the default Android to project, which provides a good overview of the entry directory structure, which is shown in bold in the import engineering catalog.
Project Setup
After importing your project, verify that the SDK and NDK locations are configured properly in File->project Structure ..., otherwise you will fail to compile.
Select target configuration, compile and allow
You can compile and run your app directly from Androidstudio on your device. It compiles your project, compiles the APK, copies it to the phone via Usb/wi-fi, and is ready to launch it.
If your phone is set up in developer mode, your app will run without inserting it into your gearvr headset. Also, when the processing is complete you will be prompted to insert your phone device into the headset to launch the app.
Make sure that you have configured your device according to the configuration steps in the Mobile SDK Configuration Guide. The app must have a Oculus Signature file signature to run.
Select the target configuration you wish to compile before compiling by selecting edit Configurations ... In the Project drop-down menu in the Androidstudio toolbar.
After the Project drop-down menu is displayed correctly, you will see the Run and debug icons. Click any one to compile and run your project.
When you click Run or adjust, the Select Device dialog box is opened. This usually sets a default emulator. Select a running device and select the appropriate option.
After this, the phone may prompt you to enable USB debugging, if the device is not connected there will be no prompt, try the following:
1. Come to your mobile developer options.
2. Turn off USB debugging and turn it on.
This will cause the USB debug instructions to be displayed.
You can also compile and clear your project without running it by using the Build menu.
Synchronous Engineering
If you edit a *.gradle file or install a Oculus MOBILESDK update that contains Gradle engineering updates, you must gradle sync to update the Android Studio project file.
Click on the sync Project with Gradle files in the Androidstudio toolbar to show on.
Android Studio Essentials