Getting Started with Android Development

Note from Ray: Although this site has been focused on iOS development so far, I thought you guys might enjoy learning a bit about Android development as well. So iOS tutorial team member Ali Hafizji has put together this great tutorial on Android development for beginners! I had never programmed for Android before, but bought […] By Ray Wenderlich.

Leave a rating/review
Save for later

Note from Ray: Although this site has been focused on iOS development so far, I thought you guys might enjoy learning a bit about Android development as well. So iOS tutorial team member Ali Hafizji has put together this great tutorial on Android development for beginners!

I had never programmed for Android before, but bought myself a device and used this tutorial as my first introduction to the platform. Now that I have a simple app running on my device I’m excited and eager to learn more, and I hope you guys will feel the same way! :]

Learn how to make this simple master/detail Android app!

Learn how to make this simple master/detail Android app!

Learn how to make this simple master/detail Android app!

This is a blog post by iOS Tutorial Team member Ali Hafizji, an iOS and Android developer living in India.

Since I’ve been following this blog, I’ve never read a post related to Android application / game development. So I thought writing something in that area would be helpful to any beginner :]

Android is an amazing and fun platform to work on. Anyone can come up with their own unique idea, create a good product and make it available to thousands and thousands of customers.

In this tutorial, we will create a “Hello World” Android app, get it working on the emulator or a device if you have one, and create a simple master/detail app that shows a list of quotes by our favorite hero, Steve Jobs. I’ll even show you how to build the app for distribution on the Google Market!

And yes, it is a little ironic to make a Steve Jobs quote app on an Android device, but hey this is mainly an iOS blog after all ;]

So keep reading to dive into the wild world of Android!

So Many Devices!

Anyone who wants to buy an android device has a large variety to choose from. There are more than 300 android devices in the market each with their own hardware features. If your primary concern is development, get the best phone that matches the lowest API level that you wish your software to support, so you can test with it. Use the emulator to test other API levels. If your primary concern is having a good phone, get the best phone and use the emulator to test other API levels.

For app development, it doesn’t really matter which phone you get aside from API levels, for game development you might want the slowest phone that you intend to support so you are forced to write efficient code.

Considering all this if you want to buy a phone for software development I recommend buying the Samsung Galaxy Ace, Htc Wildfire S, or Motorola Droid X2. Any should meet your development needs, and you can pick up a fairly inexpensive used one from the links above.

However if you’re looking for the latest and greatest, I recommend Google’s new Nexus 4. This just came out and is one of the most powerful devices out there, and is running the latest version of Android (Jelly Bean).

Note from Ray: I ended up purchasing a used Motorola Droid X2 for about $150. I chose this device because I wanted something cheap for testing purposes, and didn’t want to pay a monthly contract. I hooked up the phone to my local Wi-fi network (bypassing the activation screen by tapping the upper left, upper right, bottom right, and bottom left of the screen where it says to tap the android). I was successfully able to use this device to go through the tutorial.

Setting Things Up

Before we start with the installation process first verify that your computer meets the basic system requirements. If you’re on a mac like me make sure you have Mac OS 10.5.8 or later (x86 only).

Step 1: Verify JDK is installed

The first step is to check if you have the JDK (Java development kit) installed. Mac’s usually come with the JDK preinstalled and ready to use.

To check what version of the JDK you have open up a terminal and type in the command “which java”. Go to the directory that is printed and enter the command “java –version”. Here is what the output looks like:

If for some reason you do not have Java installed, you can download and install it from

Step 2: Download Eclipse

The next step is to download eclipse (the classic version is recommended). You can download it from

Step 3: Download the Android SDK

You can download the Android SDK from and unpack it. Note you may want to put your Android SDK in a safe spot since you’ll be using it a lot.

Once done, go to the tools folder and double click the android executable. This will open the Android SDK and AVD manager.

Step 4: Download Packages

Click on Available packages this will show a list of all the available Android SDK’s. Download an SDK that you want to build your app for.

To choose an SDK based on your device, go to Settings\About phone\Android version to see the version your phone is running. Then choose an SDK that is the same version as your device or earlier.

Step 5: Install ADT plugin

Next we need to setup the ADT plugin. To do this start eclipse go to Help > Install new software. Click Add on the top right corner

Enter the following URL: Check developer tools, click Next, and walk through the wizard to install the tools.

After you restart Eclipse, it will prompt you for the Android SDK installation directory. Select “Use existing SDKs” and browse to the directory where you downloaded the Android SDK, and finish the wizard.

That’s it! You have successfully setup your development environment.

Note: Some of the above steps may not work if you’re not a Mac user. If that’s the case please find the detailed steps here:

Hello Android!!

Assuming you have successfully installed everything, its time to create your first android project.

Step 1: Creating the project

  • Start eclipse
  • Go to File > New > Other > Android and select Android Application Project. You should see the following popup screen (yours may be slightly different or split into several steps):

  • Enter all the details as I have. Here is a brief explanation of each field:
    • Project name is the name of the directory that contains the project files (name it QuoteReader because that’s what we’ll make).
    • Build target specifies which version of Android the application is built for. I’ve selected 4.0, which is Ice Cream Sandwich.
    • The properties elements are self explanatory except for the MIN SDK property. This is used for backward compatibility i.e. if your application requires a minimum api level, or is designed only to support a certain range of Android platform versions. Setting this to a value ensures that your application can only be installed on devices that are running a compatible version of the Android system.

Okay! Now that you have entered all the details press next. Eclipse will now create the project, which you can see in your project navigator.

Step 2: Understanding the project structure

Before we get started with any code lets spend some time going through the project structure.

Here is a brief description of the folders present:

  • Source (src): This folder contains all the source files i.e. this is where all the code is.
  • Res: This is the area where you keep your images, strings and xml layouts.
  • Assets: This is another place where you can keep files. The difference between /res and /assets is that Android does not generate IDs for the assets. What this means is that to access a file in assets the developer has to provide a complete path to that file.

Now that you have a basic understanding of the project structure, lets run the application.

Step 3: Running the application

There are two ways in which we can run the application either on an actual device or on an emulator. I will explain how to do both very briefly.

To run the application on the emulator we first need to create an AVD (Android virtual device). This is an instance of the android emulator. To do this, follow these steps:

  • Go to Window > Android SDK & AVD Manager and click New in the top right corner.
  • Enter all the required details.

  • Click on “Create AVD”, after that you can start the emulator by just selecting it from the AVD manager and clicking on start.

After the emulator starts up you can run the application that you just created. To do this right click on the project, go to Run As and select Android Application. This will launch the app on the emulator.

Running the application on the device is fairly simple and requires very little effort. Here are the steps to launch an app on the device:

  • On your device, to to Settings\Application\Development and select the checkbox next to USB debugging.
  • Connect the device to your computer with a USB cable.
  • Run the project through eclipse. You will see the following popup:

  • Select the device and you’re app will be deployed.

Note: Notice that the popup above shows two options; the reason being I already have an emulator running hence I need to choose where to deploy the app i.e. either on the emulator or the device.


Over 300 content creators. Join our team.