Skip to main content

Ready to market your stellar app?

Samsung Developer Program is your gateway to app monetization success.

Learn More

Samsung Developer Program

Build Instructions

GearVRf app requirements, build instructions, building and running, and sample apps


In order to build and and run GearVRf applications (your own or sample apps) in Android Studio, you have two options:

 

Locally Build Gear VR Framework   Use Previously Built Gear VR Framework
Prerequisites (with source code download)   Prerequisites (with pre-built release download)
Build Gear VR Framework    
Generate GearVRf API Details (optional)    
Building and Running GearVRf App   Building and Running GearVRf App

 

 

Prerequisites

For BOTH methods, locally building AND using a pre-built framework, the following prerequisites must be met.

 

  1. Latest Gear VR Framework
    1. When locally building the framework:
      1. Get the latest source code zip file:
        1. In https://github.com/Samsung/GearVRf, click Download ZIP
        2. Unzip to path to a convenient local directory (the GearVRf directory) 
          in order to use the Gear VR Framework source code files.
           
    2. When using a pre-built framework:
      1. Download the latest release zip file:
        1. In the GitHub GearVRf releases https://github.com/Samsung/GearVRf/releases, click libs-gvrf.zip
        2. Save the zip file to a convenient local directory.
        3. On your local machine, unzip the file and put the unzipped libs folder into your GearVRf app folder 
          (for example, /gvrfApp/libs-gvrf/gvrf_exported.jar and /gvrfApp/libs-gvrf/lib/). Also copy the Oculus library file VrApi.jar to the same location.
           
  2. JDK 1.7 or above 
    Download it from http://www.oracle.com/technetwork/java/javaseproducts/downloads/index.html.
     
  3. Android Studio 2.1 or later
  4. Oculus Mobile SDK 1.0.4
    Download it from https://developer.oculus.com/downloads/#sdk=mobile
    Put the Oculus SDK folder at the same directory level as your GearVRf directory. 
    For example, if your GearVRf directory path is / path / to / convenient / local / directory / GVRf / 
    put the Oculus SDK in / path / to / convenient / local / directory / ovr_sdk_mobile/ 
    NOTE: Remove the version information from the pathname.

    Add the OVR_MOBILE_SDK parameter to gradle.properties and set it to the path of the Oculus Mobile SDK. It is recommended to use the global gradle.properties ($HOMEPATH/ .gradle/gradle.properties or ~/ . gradle/gradle.properties)

  5. Android SDK (version 5.0.1 or higher) 
    1. After you set up the Android Development Tools, open the Android SDK Manager.
    2. Download the newest version of Android SDK Tools and build tools.
    3. Download Android 5.0.1 (API 21).
       
  6. If optionally building the GearVR Framework, Download Android NDK (version r10e or later) from https://developer.android.com/ndk/downloads/index.html

 

Building Gear VR Framework

You can optionally locally build GearVRf from source code using Android Studio.

 

To optionally locally build the Gear VR Framework from source code using Android Studio:

  1. Add OVR_MOBILE_SDK to gradle.properties and set it to the path to the Oculus Mobile SDK; recommended to use the global gradle.properties ($HOMEPATH/.gradle/gradle.properties or ~/.gradle/gradle.properties).
  2. Add ANDROID_NDK_HOME to gradle.properties and set it to the path to the Android NDK installation.
  3. Navigate to the GearVRf/GVRf/Framework and select the folder, and click OK
  4. Click Make Project (from the Build menu)

 

 

Generating a GearVRf API Reference Javadoc

When locally building the Gear VR Framework, you can optionally generate Javadoc files with details about the GearVRf API.

 

Optional   To get GearVRf API reference details by generating GearVRf Javadoc files in the specified directory:

  1. In Android Studio, click Project > Generate Javadoc...
  2. In the Generate Javadoc window:
    1. Javadoc command: (Pathname to the Javadoc executable file)
      Typically, in the bin directory of the Java directory.
    2. Click on the plus-icon to expand the Framework listing.
    3. Checkmark src
    4. Select Use standard doclet
    5. Destination: (Convenient local directory to contain the Javadoc files)
    6. Optional Specify VM options:
      NOTE: You may encounter errors if VM options is not specified.
      1. Click Next >
      2. Click Next >
      3. VM options: -bootclasspath [path to your Android jar file]
        (Typically the pathname ends in .../android/sdk/android.jar)
    7. Click Finish

 

Building and Running GearVRf Applications

After you have the Gear VR Framework, by either locally building or using a pre-built framework, you can now import, build, and run GearVRf applications (your own or sample apps) in Android Studio. The specific procedure you use depends on whether you locally built the Gear VR Framework from source code files or used pre-built framework files.

 

  1. When building your own GearVRf apps from scratch, copy the appropriate device XML file from the GearVRf SDK to your application's assets folder. 
    GearVRf provides an xml file for you to use: gvr.xml.
  2. Import the GearVRf application code.
    • Click File -> Open ...
    • Navigate to the project folder (for example, gvr-simplesample).
    • Click OK
  3. Clean and build the application.
    • Go to the Build menu and click Clean...
    • Click Make Project (from the Build menu)
  4. Run the application.
    NOTE: You may need to apply to Oculus for a signature file for your device.
    For application and use details, refer to the online signature generator (https://dashboard.oculus.com/tools/osig-generator/)
    1. Connect an Android mobile device to your local machine.
    2. Select your project in the project explorer
    3. Click Run on the toolbar
  • Was this article helpful?