Andoid Hello World in Under 10 Minutes

November 15th, 2007

I started to write my first simple Google Android app at 10:30 tonight and was done by 10:45.  This included installling the SDK, installing and configuring the Eclipse plugin, coding (okay it was one line), and running the application in the emulator.

Android

So, big deal you say.  Well, I can tell you it is a big deal.  Try to do a similar feat (configuring an IDE, coding Hello World, and emulator execution) in the land of Symbian C++ and it will take you a day if you’re lucky.  A Java ME Hello World app from end to end will take at least an hour and more likely two.  The only mobile dev environment that is in the same ball park is Windows Mobile and building a .NET Compact Framework application.  I’m not making these numbers up; this comes from first hand experience. 

This is a great start… Android you got my attention.

Here is what you have to do run Hello World Andoid style (this is for a Windows machine w/ Eclipse installed):

Install the SDK - (http://dl.google.com/android/android_sdk_windows_m3-rc20a.zip)

  1. Just download the package and extract to your file system… i stuck mine in c:\program files
  2. Set your path variable (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, and add the full path to the tools/ directory - it’ll look something like C:\Program Files\android_sdk_windows_m3-rc20a\tools
     

Install the Eclipse Plugin (excepted from http://code.google.com/android/intro/installing.html)

  1. Start Eclipse, then select Help > Software Updates > Find and Install….
    In the dialog that appears, select Search for new features to install and press Next.
    Press New Remote Site.
    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.
    You should now see the new site added to the search list (and checked). Press Finish.
  2. In the subsequent Search Results dialog box, select the checkbox for Android Plugin > Eclipse Integration > Android Development Tools and press Next.
  3. 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.
  4. Restart Eclipse.
  5. After restart, update your Eclipse preferences to point to the SDK root directory ($SDK_ROOT):
    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 find the SDK root directory (installed in step 1 above)
    Press Apply, then OK

Code Hello World and Run in the Emulator

  1. Modify the XML based layout file
  2. Open main.xml in res/layout and modify the attribute as needed …something like so: android:text=”Hello Kevin”
  3. Run and your done!

Entry Filed under: Mobile