Monday, January 5, 2009

How to build your own Google Android app

Google's Android mobile development platform has rightly caused a stir.

Based on Linux and with built-in 3D, SMS and web browsing courtesy of WebKit, it's an entirely self-contained and free mobile operating system.

Though there are only a few devices that currently support Android out of the box, it's designed as an open, free platform to simplify the process of programming mobile applications on Java.

Getting started

The Android SDK is easily installed, though it's worth noting a couple of things before starting. The latest version can be found at http://code.google.com/android/download.html.

The Windows version is archived in a zip file. We'd advise extracting the archive to the root of your main hard drive, taking care to maintain its folder hierarchy. Once extracted, you'll have a folder named something like 'android-sdk-windows-1.0_r1'.

We'll be using an IDE – the open-source development environment Eclipse – to examine and develop apps, so keep the path and path name simple. Rename the main folder 'android-sdk'.

You'll be adding the SDK path to Eclipse when we install it, but you can protect against problems by adding the path to Windows' system settings. Right-click on the My Computer icon, choose 'Properties' and click 'Advanced'. Click the 'Environment Variables' button. In the 'System Variable' section, click 'New' and create a new variable named 'android', giving the path 'c:\android-sdk\ tools', where 'c' is your main drive.

Android's application programming framework sits on top of Java – so you'll need to install the Java SE Development Kit (JDK) 6 before you go any further. The specs call for Sun JRE 5 or 6 too. You'll find the full package for Windows and other OSes at www.developers.sun.com/javase/downloads. By default, the JDK will install into the Program Files folder. Simplify folder names and move to the root of your local machine to ensure that all of your command line tools work properly.

Google recommends Eclipse as the IDE for Android, and the tools it supplies for the platform provide tight integration with the SDK. To get started with the program, grab it from www.eclipse.org/downloads. There are several versions listed, but we suggest you use the Eclipse for Java EE Developers, because it includes WST (Web Standards Tools), a set of components for working with web scripting languages in Java.

Again, install Eclipse in the root directory of your hard drive rather than your Program Files folder; this makes it easier to set up paths to the IDE and reduces the likelihood of errors caused by calls to DOS-based SDK components. The archive simply extracts – there is no installer. You can create a shortcut to the Eclipse runtime by selecting 'eclipse.exe' and [ALT]+dragging a copy to your desktop or Start menu.

Once Eclipse is installed, you can add the Android tools that are required to develop and work with existing apps. These integrate some Android SDK components into Eclipse. Start the program, then go to 'Help | Software Updates'. Select the Available Software tab.

Choose 'Add Site', type in the full URL (https://dl-ssl.google.com/android/eclipse) and then click 'OK'. The 'Software Updates and Add-ons' window should update, showing the newly entered URL. Open the hierarchy by clicking the '+' sign and then check the box next to 'Developer Tools'. Click 'Install'.

In the next window, check both 'Android Developer Tools' and 'Android Editors', then click 'Finish'. Finally, restart Eclipse.

Read More..

No comments: