Android Development Software Setup for Mac OS X

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

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

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

Your Samsung device may display a notification recommending you install Android File Transfer, a handy application for transferring files between OS X and Android.

Xcode

Before installing any Android development tools, you must install Xcode.

Once installation is complete, some of the following steps (such as installing the JDK) may be unnecessary.

To download Xcode, visit https://developer.apple.com/xcode/download/

Java Development Kit (JDK)

Install the JDK if it is not already present on your system. If you have already installed Xcode, this step may be unnecessary.

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

Android Studio Installation

To use Android Studio as your primary IDE, download the Android Studio Bundle from the following location: https://developer.android.com/sdk/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 the install instructions located here: https://developer.android.com/sdk/installing/index.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. Once downloaded, unzip the archive into the directory where you would like to install it, e.g., ~/Dev/Android/android-sdk-r24.4.1.
  3. Set the environment variable ANDROID_HOME to your Android SDK location. The correct syntax for setting your environment variable is: export ANDROID_HOME=<path to SDK>/android-sdk-r24.4.1
  4. Add the SDK tools and platform tools directories to your PATH: 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 without Android Studio, open a terminal and navigate to the tools/ directory of the SDK Tools Package location, then execute the program ‘android’. If you would rather download packages directly from the command-line, instead run android list sdk -a to see a list of packages, then run android update sdk -a -u -t [package id]. For help locating the package id, run android -h update sdk.

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

The following packages are required for native development:

  • Android SDK, 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 which come with this release.

The latest version which has been tested with this release is NDK r13b - it is available for download at the following location: https://developer.android.com/ndk/downloads/index.html.

Once downloaded, extract the NDK to your home/dev folder (~/dev). Your dev folder should look something like the following:

Note that Android Studio and the NDK are extracted into their own folders. These folders may be given any name you wish, but they must be installed into separate folders to avoid any conflict between the two packages.

Set the ANDROID_NDK_HOME environment variable to the directory where you have installed your NDK. For example:

export ANDROID_NDK_HOME=~/dev/android-ndk-r13

Then add the NDK directory to your PATH:

export PATH=$PATH:$ANDROID_NDK_HOME

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.

Manual Installation

  1. Download from http://gradle.org/gradle-download/ (requires version 2.5+)
  2. Extract into some common development directory. For example: ~/android/gradle-2.10
  3. Add the Gradle bin directory to your PATH variable. For example: ~/android/gradle-2.10/bin
  4. Open a new Terminal window to refresh the PATH variable.

You should now be able to build with ./build.py -g

Install using Homebrew:

Requires Homebrew, an optional package manager for OS X.

  1. Run brew install gradle in the terminal.
  2. Open a new terminal window to refresh the PATH variable.

You should now be able to build with ./build.py -g

Install using MacPorts:

Requires MacPorts, an optional package manager for OS X.

  1. Run sudo port install gradle in the terminal.
  2. Open a new terminal window to refresh the PATH variable.

You should now be able to build with ./build.py -g