last updated Mon 2019/01/07
In order to develop Android apps, you will need to install two things: Oracle Java Development Kit ("JDK") and the Android Studio editor. Here are the TL;DR really short instructions:
|1. Install JDK||2. Install Android Studio||3. Create a Virtual Device|
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 around 1gb or more 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. When you first run Android Studio, there are further questions and downloads of various components; you may again use all of the defaults for this part of the process. Make certain that the "Virtual Device" checkbox is checked during your install, if available.
(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:
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 or Install some components.)
In general, you can use all of the default settings and names for your project. But if there is a checkbox for "Kotlin support" during the project creation, make sure to check it. 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.
On most machines, you can choose the default virtual device that was created during installation. (Ours was called "Nexus X API 28" when this guide was last updated.)
If you don't see any virtual devices available, you may need to create one. Click "+ Create Virtual Device...", then mostly choose the defaults. Set Category to "Phone", Device name to "Nexus 5X". On the next screen about System Image, Choose Pie. If necessary, click "Download" next to "Pie" to install the necessary software.
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: