All Articles Kinsa Creative

Setting up a Java Development Environment for Android Studio on Apple Mac OS X Yosemite

Android Studio is Google's official Integrated Development Environment (IDE) for Android application development.

Getting it setup on Mac OS X is somewhat convoluted due to the variations in Java that are required and the specific order in which things need to be installed.

Note that these directions specifically refer to Mac OS X Yosemite 10.10.2 with no prior installations of Java running on a 1.7 GHz Intel Core i7 processor.

While Android Studio runs on Java 1.6, Android 5 (Lollipop) and up require Java 1.7. This is alluded to in the system requirements for Android Studio, the Android docs and on this StackOverflow post.

The installation order needs to be:

  1. Java 1.6
  2. Android Studio
  3. Java 1.7 (or Java 1.8 as end of updates for Java 1.7 is April of 2015, tomorrow as of this writing)

Installation

Download Java 6 from Apple (A quick note on making sense of Java version naming: Java 6 is Java 1.6. Depending on where it's mentioned the point release is referred to without the 1. in front of it.)

Verify that installation. In a Terminal window run java -version the output should look something like:

$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

Download Android Studio from Google and install the DMG (note that Android Studio includes an installer for the SDK (Software Development Kit) Tools which doesn't need to be downloaded separately from the site). Launch Android Studio to finish installation and download and install the SDK. Go the custom route and don't install any Android Virtual Devices (AVDs) just yet. The default AVD is a 32-bit Intel build which is going to be slow and not take advantage of virtualization accelerators.

Download and install the Java SE (Standard Edition) Development Kit 8 from Oracle. (The Java SE Development Kit 8 is also sometimes referred to as the Java 8 JDK (Java Development Kit) and includes the JRE (Java Runtime Environment) which does not then need to be installed separately. The Oracle Java Conceptual Diagram is a great graphic that explains the what's included with what.)

After installing, Java 1.8 will be the installed version:

$ java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

To use Java 1.8 in a project, after creating the project in Android Studio, navigate to File -> Project Structure and set the JDK location to /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home.

The fastest AVDs for the Intel processor architecture will be the ones designated x86_64. Open the AVD Manager from Android Studio and add a new AVD, specifying an x86_64 build.

Install any additional SDK Packages desired following the recommendations from Google.

Revisions

March 31, 2015
Referenced the separation of Android Studio from the Stand Alone SDK Tools Installer and described how to install SDK Tools via Android Studio.
June 9, 2015
Included link to Oracle Java Conceptual Diagram.

Feedback?

Email us at enquiries@kinsa.cc.