Install Android development environment on Windows 7

About a year ago I wrote a blog post about how to get started with Android development on Windows. At lot of new versions has been released since then, even though the basic packages needed are the same. This is a recap of what to download and how to set it up in order to develop Android applications on Windows 7 (64-bit).

My background is primarily in Microsoft.NET and Microsoft Visual Studio, so it did feel a little different when I first entered the world of Java and Android development. But once you get past those initial hurdles, it isn’t as different as you first might have thought.

These are the steps to get started with Android development on Windows. Should work on any Windows version, but I’m using Windows 7 64-bit.

  1. Download and install Java SDK.
  2. Download and unzip Android SDK.
  3. Run “SDK Manager” from Android SDK to download the platform versions.
  4. Download and unzip Eclipse.
  5. Install the Android plugin for Eclipse and point to the Android SDK.

You can read the instructions here, or watch a screencast I made describing the same procedure:

http://vimeo.com/16392228

Download and install Java SDK

You’ll find the Java SDK here:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Click the “Download JDK” button and choose the Windows version you have from the Platform combobox. You don’t have to register to download. I ended up downloading a file called “jdk-6u22-windows-x64.exe”. Run it and accept all defaults to complete the installation.

Download and unzip Android SDK

The Android SDK doesn’t have an install executable, but rather a zip file and a utility called “SDK Manager.exe”. Begin by downloading the sdk from here:

http://developer.android.com/sdk/index.html

Unzip the file to any location you want. I put it in “C:\Android\SDK”. Inside that folder, you’ll find the executable “SDK Manager.exe”. Run it. Every time you run that application, it will look for updates to anything you’ve downloaded previously with the same tool. The first time it will default to download all platform versions of Android except the Google specific ones. I’d recommend selecting Cancel at this initial update dialog, and then download what you need from “Available packages” instead.

The Android platform has been released in several versions since its initial offering of version 1.0. Every Android application will require a specific version, but will of course work on all subsequent versions too (at least in a perfect world). Today, I recommend that you target version 2.1 as the least common denominator. But note that there might still be users and phones of at least version 1.6 that might be of interest to you. Anyway, this means that I would download version 2.1 and the latest version 2.2. They don’t really take up that much disk space (maybe ~100MB per version?), so it won’t hurt you too much to download them all either.

Also, every Android platform version comes in a “Android plain vanilla” variant and a “Google APIs” variant. The only differences between those two are that “Google APIs” variant will include the ability to use Google Maps component and some other Google specific APIs that some Android devices might not support. I found this naming to be a little strange at first, but note that “Google APIs” includes everything in “Android plain vanilla” too.

The point is that if your application doesn’t need things such as Google Map component, you will be targeting more devices if you choose to develop for “Android plain vanilla”. As far as I know, all commonly sold Android phones support the Google APIs and it is only simpler media players and maybe cheap tablets that might not have chosen to support Google APIs (since I assume the manufacturer pays licensing fees to Google for that).

Run “SDK Manager” from Android SDK to download the platform versions

So, running “SDK Manager”, cancelling on the first update dialog box, you’ll move on to “Available packages”. I recommend checking the following items and then click “Install selected”: (revision numbers can of course have changed since I wrote this)

  • SDK Platform Android 2.2, API 8, revision 2
  • SDK Platform Android 2.1, API 7, revision 2
  • Samples for SDK API 8, revision 1
  • Google APIs by Google Inc., Android API 8, revision 2
  • Google APIs by Google Inc., Android API 7, revision 1
  • Usb Driver package, revision 3
  • Market Licensing package, revision 1

You’ll need to “Accept all” licenses and then the download should start. You might get a question if it is ok to restart ADB at the end of the installation procedure, which it is!

Download and unzip Eclipse

You don’t have to use Eclipse. You could stop here and use a command line utility from the Android SDK to create project skeletons and edit the files with any text file editor. But I think you’ll enjoy the full development environment of Eclipse, even though it seems to have gotten its share of complaints over the years.

Download Eclipse from here:

http://www.eclipse.org/downloads/

The first option of “Eclipse IDE for Java Developers” is what you want, and click the link to the right depending on what Windows version you’re on. I ended up downloading “eclipse-java-helios-SR1-win32-x86_64.zip”.

Eclipse doesn’t have an install at all. Just unzip the files into any folder you like and start the environment with “eclipse.exe”.

Install the Android plugin for Eclipse and point to the Android SDK

Inside Eclipse, you need to do a few things before you can create your first Android project. When you start Eclipse, you choose your “Workspace”. Just accept the default. This is the base folder where you will put all of your projects, and can of course be changed later on.

Now, do the following:

  1. Select Help menu
  2. Install new software
  3. Add
  4. Type any Name, like “Android”
  5. Paste this address in Location: https://dl-ssl.google.com/android/eclipse/
  6. OK
  7. After a few seconds, the list should contain “Developer Tools” and there you’ll find “Android DDMS” and “Android Development Tools”.
  8. Select both and then Next
  9. Continue with the download and install. You’ll be asked to restart Eclipse at the end. Do that.

Back in Eclipse with the Android plugin now installed, you also need to:

  1. Select Window menu
  2. Preferences
  3. Android
  4. Click Browse button next to “SDK Location”
  5. Point to the folder where you unzipped the Android SDK previously. For me, that would be “C:\Android\SDK” (where the “SDK Manager.exe” is located)
  6. OK
  7. Apply
  8. After a few seconds the list should fill with the Android platforms you chose to download with “SDK Manager” previously
  9. OK

That’s it!

Create your first Android project

Now you should be able to create your first Android project. Still in Eclipse:

  1. Select File menu
  2. New
  3. Project
  4. Android, Android Project
  5. Next
  6. Project name: My first project
  7. Build Target, Target Name: check any platform version you’d like to start with
  8. Application name: MyFirstProject
  9. Package name: com.myname.MyFirstProject
  10. Create Activity: (checked) MainActivity
  11. Min SDK Version: (can be left empty)
  12. Next
  13. Finish (no test project for your first attempt)

Now, right-click the project name in the left pane and choose “Run as” and then “1 Android Application”. The emulator should start and after some time (it IS really slow to start), you’ll be running your first Android application. If the emulator starts, but not your application, just keep the emulator running and switch back to Eclipse and execute the “Run as” command again. Sometimes it fails on the first attempt.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s