last updated Thu 2016/12/22
In order to develop Android apps, you will need to install two things: Oracle Java Development Kit ("JDK") and Android Studio SDK. Here are the TL;DR really short instructions:
|1. Install JDK||2. Install Android Studio||3. Configure Android Studio|
Since Android apps are written in Java, you will need the Oracle Java compiler and libraries on your system. These are collectively called the Java Development Kit or "JDK" for short. (If you are certain that you already have JDK 1.8 or higher on your computer, such as from taking CS 106A, you can skip to Step 2.) Download the JDK from the following address:
Go to the page and click the DOWNLOAD link for the JDK. (Be careful to choose "JDK" and not "JRE".) Click the radio button to accept the License Agreement, then download the appropriate JDK for your operating system. For example, on Windows, click to download the "Windows x86" installer.
(A common mistake here is to accidentally download the Java Runtime Environment, or "JRE", instead of JDK. The JRE is not the right download; JRE enables you to run Java programs but not compile or develop your own. Be careful to download JDK and not JRE.)
Once the JDK installer is done downloading, run it to install JDK on your system. You can use all of the default settings.
The next piece of software for you to install is called Android Studio. This is an official text editor and integrated development environment (IDE) for developing Android apps. You must install Oracle JDK before installing Android Studio, so please don't start this step until you have completed Step 1 above.
Download Android Studio from the following address:
Once you click the Download link, you will be asked to accept a license agreement. Then you will be able to download the software. The download may take a while because the file can be almost 1gb in size.
Once you have downloaded the installer, run it to install Android Studio on your computer. The installation make take a while because of all the components and libraries included. You can choose all of the default settings during the installation.
(Mac OS X only) If you are using a Mac, your computer might try to block the Android Studio installation. You might see a warning that says, "The package is damaged and should be moved to the trash." If your OS is blocking the installation, go to System Preferences > Security & Privacy and under "Allow applications downloaded from", select Anywhere. Then try to open Android Studio again.
(Windows only) If you are using the Windows operating system, you should also download and install the following USB driver pack. These USB drivers will help you to deploy apps to your phone or tablet from your computer.
If you need more information, see Google's Android page on installing Android Studio:
Once Android Studio is installed, we'll need to configure a few important settings and install a few extra features. First, launch the Android Studio application. This may take a while, as the app needs to complete the installation and initial configuration, as well as downloading and applying any updates.
Once Android Studio is running, you will need to load the "SDK Manager" menu. This is found by clicking the following icon in the top toolbar:
The SDK Manager window has a series of nested sections to allow you to install various packages and features. The overall list has categories such as Tools, Android 7.1.1, Android 6.0, Extras, etc. These represent various versions of Android that could be installed on your system.
First, make sure this checkbox at the bottom-right is checked: "Show Package Details". Then click the first of these categories. (As of this writing, that is "Android 7.1.1".) Make sure the box is checked for "Android 7.1.1 Platform". Also check the boxes for "Intel X86 Atom System Image" and "Google APIs Intel x86 Atom System Image". We will need these in order to run the emulator.
Once you've selected all the desired packages, Click the Apply button at bottom-right. You may need to accept the license agreement for each installed package. Once you do so, he packages will be downloaded and installed for you. Wait until the packages are finished downloading and installing before proceeding. (Wait for the "Finish" button at the bottom to become clickable, and click it.)
If you need more information on this step, see Google's Android page on adding packages:
To run your Android apps on your computer, you can use a "virtual device" which is a software emulation of an Android phone or tablet. In past versions, you needed to set up this virtual device yourself. But if you install the current version of Android Studio with the default settings, it automatically creates a "Nexus X" device for you, so you don't need to do anything here. Hooray!
If you need more information on this step, see Google's Android page on virtual devices:
You're basically done now, but let's make sure everything is running properly by creating and running an empty "Hello World" project. Load up Android Studio and click "Start a new Android Studio project". (If this is your first time ever running Android Studio and creating a project, you may need to Accept the license agreement.) You can use all of the default settings and names for your project. In particular, when you get to the "Add an activity" screen, just choose the default "Blank Activity" option. Click Next and Finish on each screen until the project is created.
Once the project is created, you should see a Design view with a palette of widgets and a preview image that looks like an Android device. You don't need to edit any code or anything yet.
Click the "Play" button icon in the top toolbar to run the app: Once you do this, it will ask you what virtual device you want to use. You can choose the default virtual device that was created during installation. (Ours was called "Nexus 5 API 21 x86" in the screenshots when this guide was written.)
If you get the following error at this point:
emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable. CPU acceleration status: HAX kernel module is not installed!
There are two ways to fix this error. The first fix is to enable hardware acceleration by following Google's instructions for configuring VM acceleration. This is the preferred fix if possible. If that fix does not work, you can instead change your VM to use the ARM CPU mode rather than x86. Unfortunately, changing your VM to ARM mode will make the VM run very slowly because it is not hardware accelerated.
To change your VM to ARM mode, click the AVD Manager icon at the top of Android Studio: Then you should see your default Nexus device. Press the "pencil" icon on the right side to edit the device's configuration. In the configuration screen, in the area for the android version Lollipop, at right click Change. In the window that appears, select a row where the "ABI" starts with "arm", such as "armeabi-v7a". Then click Next/Finish to get back to Android Studio.
When you try to run the app on your virtual device, sometimes the device just sits at the device's home screen rather than automatically running your app. If this happens, click the bottom-right button in the virtual device, the one that looks like a 3x3 phone keypad. This should pop up a list of all apps available. Find your app in the list and click it to run it.
If you need more information on this step, see Google's Android page on creating a first project: