Android Development Software Setup for Windows

In order to develop Android applications, you must have the following software installed on your system:

  1. Java Development Kit (JDK)
  2. Android Studio Development Bundle or Standalone Android SDK Tools
  3. Android Native Development Kit (NDK)

Gradle installation is recommended but not required. See Gradle for more information.

Java Development Kit (JDK)

The Java Development Kit is a prerequisite for Android Studio and Gradle.

The latest version which has been tested with this release is JDK 8u91, available from the Java Archive Downloads page: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html

The latest JDK version is available here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Once downloaded and installed, add the environment variable JAVA_HOME and set its value to the JDK install location. For example, the value may be C:\Program Files\Java\jdk1.8.0_91, if you have installed the x64 version.

Based on the default installation path of Java SE 8u91, the correct syntax when using set from the command line is:

set JAVA_HOME=”C:\Program Files\Java\jdk1.8.0_91”
Note: The JAVA_HOME value must be your actual path, which may differ from these examples.

Additionally, add the JDK to the value of your PATH, e.g. C:\Program Files\Java\jdk1.8.0_91\bin

Android Studio Installation

To use Android Studio as your primary IDE, download the Android Studio Bundle from the following location: https://developer.android.com/studio/index.html

The Android Studio Development Bundle includes the basic tools you need to begin developing Java Android Applications:

  • Android Studio IDE
  • Android SDK tools
  • Latest Android Platform
  • Latest System Image for Emulator

Once downloaded, refer to the readme.txt included with the Android SDK, or follow Android’s installation instructions: https://developer.android.com/studio/install.html?pkg=studio

Standalone Android SDK Tools

Some developers may wish to develop mobile VR applications without using Android Studio.

This section describes how to set up for development using the basic set of tools needed for development using the standalone Android SDK and Gradle.

  1. Download the SDK Tools Package from the following location: https://developer.android.com/studio/index.html (under “Get just the command line tools”)
  2. Save the exe to the directory where you would like to install it, e.g.: C:\Dev\Android\android-sdk-r24.4.1\
  3. Once downloaded, double-click the exe to unpack its contents into the parent directory.
  4. Add the environment variable ANDROID_HOME, and set the value to your Android SDK location. For example: C:\Dev\Android\android-android-sdk-r24.4.1
  5. Using the above location as an example, the correct syntax for setting your environment variable using set from the command line is: set ANDROID_HOME=C:\Dev\Android\android-sdk-r24.4.1
  6. Add the SDK tools and platform tools directories to your PATH. The correct syntax for setting your path using set from the command line is: set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Installing Additional Packages and Tools

Android Studio

You must download additional packages required by the Mobile SDK via the Android SDK Manager, found in Tools > Android > SDK Manager. Android Studio may prompt you to take this step automatically the first time you launch it.

Standalone Android SDK Tools

To launch the Android SDK manager, double-click the SDK Manager.exe file at the root of the SDK Tools Package location.

The following packages are required for native development:

  • Android SDK 5.0, API level 21 or later
  • Android Build Tools

Once the Android SDK is installed, launch the SDK Manager to verify that you have installed the latest stable SDK Tools, Platform-tools, and Build-tools. Also verify that you have at least one SDK Platform-tools installed, preferably the one you intend to target with your application.

Android Native Development Kit (NDK)

The Android Native Development Kit (NDK) is a toolset that allows you to implement parts of your app using native code languages such as C and C++. It is used extensively by the sample applications included with this release.

Note: You may install the NDK during the Android Studio installation process, but we recommend installing it manually to be sure that your command-line environment is set up properly and agrees with your Studio setup.

The last version of the NDK known to work with the Mobile SDK is r13b.

  1. Download the appropriate version of NDK from the following location: https://developer.android.com/ndk/downloads/index.html.
  2. Save the zip to the directory where you would like to install it, e.g., C:\Dev\Android\android-ndk-r13b\.
  3. Once downloaded, extract its contents into the parent directory.
  4. Add the NDK location to your PATH. For example: C:\Dev\Android\android-ndk-r13b\
  5. Add the environment variable ANDROID_NDK, and set the value to your Android NDK location. For example: C:\Dev\Android\android-ndk-r13b
  6. Using the above location as an example, the correct syntax for setting your environment variable using set from the command line is: set ANDROID_NDK=C:\Dev\Android\android-ndk-r13b

Gradle

Gradle is a build automation suite used by our standalone build scripts and by Android Studio to manage dependencies and allow for custom build logic. Gradle replaces the previous Android build system, Ant, which is now deprecated for use in Android development.

It is not necessary to install Gradle to use the Mobile SDK. Oculus Mobile SDK 1.0+ build scripts use the Gradle Wrapper (gradlew), a small wrapper that automatically downloads and installs Gradle the first time you build a project. However, if you wish to install the full version of Gradle, we have included instructions.

The latest version which has been tested with this release is Gradle 2.10. Choose the Complete download if you want the Gradle source and offline documentation.

To install Gradle:

  1. Download version 2.10 from http://gradle.org/gradle-download/
  2. Extract into the desired development directory, e.g., C:\Dev\Android\gradle-2.10.
  3. Add the Gradle bin directory to your PATH variable, e.g.: C:\Dev\Android\gradle-2.10\bin
  4. Restart your terminal window to fetch the updated PATH variable.
  5. You should now be able to build with: build -g

Setting up your System to Detect your Android Device

You must set up your system to detect your Android device over USB in order to run, debug, and test your application on an Android device.

If you are developing on Windows, you may need to install a USB driver for adb after installing the Android SDK. For an installation guide and links to OEM drivers, see the Android OEM USB Drivers document.

Samsung Android drivers may be found on their developer site: http://developer.samsung.com/android/tools-sdks/Samsung-Android-USB-Driver-for-Windows

Windows may automatically detect the correct device and install the appropriate driver when you connect your device to a USB port on your computer.

Access the Device Manager through the Windows Control Panel. If the device was automatically detected, it will show up under Portable Devices in the Device Manager. Otherwise, look under Other Devices in the Device Manager and select the device to manually update the driver.

To verify that the driver successfully recognized the device, open a command prompt and type the command:
adb devices
Note: You will need to successfully setup your Android development environment in order to use this command. For more information, see the next section: Android Development Environment Setup

If the device does not show up, verify that the device is turned on with enough battery power, and that the driver is installed properly.