Getting Started with Android

ImageAndroid 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.

  1. Install the Android SDK
    1. Download the Android SDK and unpack it to a suitable installation folder (eg. C:\Program Files\Android SDK)
    2. Optionally, you can add the path to the SDK tools directory to your path.
      1. On Windows, right click on My Computer, and select Properties.
      2. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path under System Variables.
      3. Add the full path to the tools/ directory to the path.
  2. Download and install JDK 6 Update 3 from Sun. Updating the PATH variable is optional.
  3. Install Eclipse
    1. If you dont have Eclipse yet, download the Eclipse IDE for Java Developers package and simply uncompress the Eclipse folder to where you want it installed (eg C:\Program Files\Eclipse).
    2. Make a shortcut to Eclipse.exe on your Desktop, in your All Programs, or in your QuickLaunch.
    3. Run Eclipse and select a folder to store your Workspaces.
  4. Install the Android SDK plugin in Eclipse
    1. Start Eclipse, then select Help > Software Updates > Find and Install.
    2. In the dialog that appears, select Search for new features to install and press Next.
    3. Press New Remote Site.
    4. In the resulting dialog box, enter a name for the remote site (e.g. Android Plugin) and enter this as its URL:
      https://dl-ssl.google.com/android/eclipse/
      Press OK.
    5. You should now see the new site added to the search list (and checked). Press Finish.
    6. In the subsequent Search Results dialog box, select the checkbox for Android Plugin > Eclipse Integration > Android Development Tools and press Next.
    7. Read the license agreement and then select Accept terms of the license agreement, if appropriate. Press Next.
    8. Press Finish.
    9. The ADT plugin is not signed; you can accept the installation anyway by pressing Install All.
    10. Restart Eclipse.
    11. After restart, update your Eclipse preferences to point to the SDK directory:
      1. Select Window > Preferences to open the Preferences panel.
      2. Select Android from the left panel.
      3. For the SDK Location in the main panel, press Browse and locate the SDK directory (eg C:\Program Files\Android SDK).
      4. Press Apply, then OK.
  5. Create an Android Project
    1. Select File > New > Project
    2. Select Android > Android Project, and press Next
    3. Select the contents for the project:
      1. 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)
      2. 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.
    4. Press Finish.
  6. 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:

    1. Select Run > Open Run Dialog or Run > Open Debug Dialog as appropriate.
    2. In the project type list on the left, right-click Android Application and select New.
    3. Enter a name for your configuration.
    4. On the Android tab, browse for the project and Activity to start.
    5. On the Emulator tab, set the desired screen and network properties, as well as any other emulator startup options.
    6. You can set additional options on the Common tab as desired.
    7. Press Apply to save the launch configuration, or press Run or Debug (as appropriate).
  7. When you launch your application, the first time you will be asked if you agree to send usage statistics to Google.
  8. 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)
  9. 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

Image
Image Image

This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

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