Saturday, May 25, 2013

How to Download and Install Android Studio

This article describes how to download and install the 0.1 version of Android Studio on a Windows 7 computer.

At the recent Google IO conference, Google announced their new product for Android development: Android Studio.

Android Studio is meant to replace the Eclipse plugin for Android development. There has been a lot of excitement surrounding the tool--apparently many people are not huge fans of Eclipse. Personally, I am a fan of Eclipse, but certainly think that Android has gotten big enough to merit its own tool for development.

Version 0.1

It is important to remember that this is not a fully polished product, so there will be plenty of bugs and quirks. Google is simply releasing an early preview and labeling it version 0.1

After I ran the installer nothing happened. I attempted to run Android Studio two or three more times, but it still refused to launch. Luckily the download page included a tip if you had trouble running Android Studio. You need to set the environment Variable "Java Home" to your JDK installation directory (probably something like: C:\Program Files (x86)\Java\jdk1.6.0_17)

Other Issues

The download page also includes a link to known issues with Android Studio. I followed the instructions and navigated a command prompt to my Android Studio installation directory and ran the studio.bat file. I received the error "Unrecognized VM option '+UseCodeCacheFlushing'"

Unrecognized VM option '+UseCodeCacheFlushing'

To fix this error, the site said to remove the line XX:+UseCodeCacheFlushing from the studio.exe.vmoptions or studio64.exe.vmoptions

I opened these files to make the changes, but I encountered an error when trying to save. So I right-clicked on notepad, selected "Run as Administrator" and reopened the files for editing. This time, I was able to save.

Running Android Studio

I clicked the shortcut to open up Android Studio, and this time it successfully started up.

Android Studio Welcome Screen

Set the Android SDK Location

When I tried to click "New Project" I was met with the not very useful error message "your android sdk is out of date or missing templates"

Before you can make a new project, you must specify the location of the Android SDK. This stack overflow response had the answer to this problem.

Click Configure->Project Defaults->Project Structure

Android Studio Project Structure Dialog

On the Project page set the SDK to your Android SDK location, for example "C:\Program Files (x86)\Android\android-sdk"

Then on the SDKs tab, make sure you set a build target. For example Android 4.2.2

Android Studio Project Structure Dialog SDK page

I had trouble getting Android Studio to save my build target--the apply button would not light up after I made a selection. To remedy this, I set the build target from the drop down, and then changed the name that displayed in the "name" field. After doing this the "Apply" button was enabled.

After doing all these steps I was able to create a new "HelloWorld" project using Android Studio.