Getting Started with Android

Android is an Operating System and application suite for mobile devices. It is being developed by the Open Alliance Project, with Google being a major partner so its is developing a lot of interest. The $10 million in prizes they are offering for the best Android applications may also have something to do with it.

I decided to give it a go. Installing it and getting a simple application running on the emulator was a breeze. The installation instructions on the Android site were relatively straightforward, and the videos helped getting the application to work.

Install the Android SDK

Download the Android SDK and unpack it to a suitable installation folder (eg. C:\Program Files\Android SDK)

Optionally, you can add the path to the SDK tools directory to your path.

On Windows, right click on My Computer, and select Properties.

Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path under System Variables.

Read the license agreement and then select Accept terms of the license agreement, if appropriate. Press Next.

Press Finish.

The ADT plugin is not signed; you can accept the installation anyway by pressing Install All.

Restart Eclipse.

After restart, update your Eclipse preferences to point to the SDK directory:

Select Window > Preferences to open the Preferences panel.

Select Android from the left panel.

For the SDK Location in the main panel, press Browse and locate the SDK directory (eg C:\Program Files\Android SDK).

Press Apply, then OK.

Create an Android Project

Select File > New > Project

Select Android > Android Project, and press Next

Select the contents for the project:

Select Create new project in workspace to start a project for new code.
Enter the project name, the base package name, the name of a single Activity class to create as a stub .java file, and a name to use for your application.
The base package name should be in the format com.yourdomain.android.yourpackagename (for example com.google.android.hello)

Select Create project from existing source to start a project from existing code. Use this option if you want to build and run any of the sample applications included with the SDK. The sample applications are located in the samples/ directory in the SDK.
Browse to the directory containing the existing source code and click OK. If the directory contains a valid Android manifest file, the ADT plugin fills in the package, activity, and application names for you.

Press Finish.

Create a Launch Configuration
Before you can run and debug your application in Eclipse, you must create a launch configuration for it. A launch configuration specifies the project to launch, the Activity to start, the emulator options to use, and so on. To create a launch configuration for the application, follow these steps:

Select Run > Open Run Dialog or Run > Open Debug Dialog as appropriate.

In the project type list on the left, right-click Android Application and select New.

Enter a name for your configuration.

On the Android tab, browse for the project and Activity to start.

On the Emulator tab, set the desired screen and network properties, as well as any other emulator startup options.

You can set additional options on the Common tab as desired.

Press Apply to save the launch configuration, or press Run or Debug (as appropriate).

When you launch your application, the first time you will be asked if you agree to send usage statistics to Google.

Then your application should start in the emulator. Or at least in my case, it displayed an error (I fixed it by adding a new contact name and number)

The emulator is very cool. Clicking on the Home key lets you select from a couple of preinstalled applications such as a Browser, Contacts, and Google Maps