Android Programming — Getting Started with the SDK

Learning to program for Android devices can be daunting. While Google does have some great instructional references on their development guide, it’s easy to get lost amid the tangle of information present on the site.

Fear not! The following simple steps will prevent you from becoming overwhelmed and will help you wade into the waters of Android development.

Note: This article does not contain programming tutorials or tips; rather, it details how to set up the Android programming environment. Check back later for more specific tutorials on the actual programming aspects of Android devices.

1. The Development Environment: Java Development Kit (JDK) and Eclipse

Since Android applications are based on Java, it is necessary to install the JDK, which can be found here. Google also strongly recommends that you install Eclipse (a Java IDE), as the company has developed the helpful Android Development Tools (ADT) for it (more on this later). Make sure to install version 3.4 of Eclipse or higher.

2.  Download the Android Software Development Kit (SDK)

The next step is to download the SDK starter package, which only contains the core development tools. You’ll be able to add more components to the SDK later on.

Once the SDK is downloaded, save the unpacked directory (named android-sdk-<machine-platform> by default) and remember its location — you’ll need it later.

Although optional, you should add the SDK’s tool directory to the system PATH. Doing so will give you quick access to command line tools.

  • If you’re running Windows, right click on Computer, go to properties, click advanced system settings, and select the Environment Variables box. From there, double-click PATH under system variables and add the tools directory to the “variable value” field.

Enter the path of the SDK tools directory into "variable value"

  • Google provides the following instructions for Linux or Mac users:

“On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a line that sets the PATH environment variable and add the full path to the tools/ directory to it. If you don’t see a line setting the path, you can add one:export PATH=${PATH}:<your_sdk_dir>/tools

On a Mac OS X, look in your home directory for .bash_profile and proceed as for Linux. You can create the .bash_profile if you haven’t already set one up on your machine.”

3. Installing the ADT Plugin

The ADT provides a host of useful tools for developing Android applications, including the ability to quickly set up projects. Note that ADT is only compatible with Eclipse.

The process of downloading the ADT differs slightly depending on whether you are using Eclipse 3.4 or 3.5

For 3.4…

  • Start Eclipse
  • Go to Help > Software Updates and click Available Software
  • Click Add Site and enter the following URL in the location field: https://dl-ssl.google.com/android/eclipse/
  • Hit OK
  • In Available Software, locate the URL of the site and expand it (click on the triangle).
  • Select the box next to developer tools and install.

Check the box next to Development Tools and click Install.

  • When installing, select both “Android DDMS” and “Android Development Tools.”

Installation for 3.5 is almost identical: hit Help > Install New Software, go to Available Software, click add, and continue as you would in 3.4

Next, you’ll need to make the ADT point to the SDK.

  • Open Eclipse
  • Go to Window > Preferences
  • Choose Android
  • Browse and locate the SDK
  • Click Apply and OK

4. Adding Components to the SDK

The SDK starter package that you’ve downloaded only includes the basic tools. At the least, you’ll need to add a platform before you can start coding, although there are numerous other helpful components.

In order to install components…

  • Open Eclipse
  • Go to Window > Android SDK and AVD Manager
  • Select Available Packages

You’ll notice that there are a lot of available components to install. First, you’ll need to install a platform, or the version of Android that a program is designed for. To start off, just install the latest platform; however, you will need to install more later. Phones running on Android use different versions of the platform; for instance, some phones may run on 2.1 and others on 2.2. As such, you’ll need to install multiple platforms if you want to make sure that your apps are compatible with different versions of Android.

I would recommend that you install all the other components:

  • Documentation is always helpful and is conveniently accessibile from Eclipse
  • Samples will help you learn to code by example
  • The USB driver is needed if you want to install your app on an Android device
  • Google APIs will allow you to incorporate Google Maps in your apps

—————————————————————————————————————————————

Once you’ve finished installing components, you have officially finished setting up the SDK. Congratulations! You are now ready to start writing applications.

Leave a Reply

Your email address will not be published. Required fields are marked *