Tuesday, February 8, 2011

Getting started with Android!

Introduction
Android, as everyone should be knowing by now, is Google’s mobile platform, which is overtly loved and appreciated by developers, geeks, critics as well as foodies (like me ;-)... since Android products are named after desserts). The global smartphone market is booming, and Google's Android platform was leading the pack during the fourth quarter 2010, according to a recent report issued on Monday by Canalys Smart Phone Analysis services.
Android is an operating system based on Linux with a Java programming interface. It provides development tools (compiler, debugger, device emulator, etc.) as well as its own virtual machine called the Dalvik Virtual Machine – DVM (analogous to Java Virtual Machine). Android is created by the Open Handset Alliance which is lead by Google.
Dalvik uses special bytecode. Therefore you cannot run standard Java bytecode on Android. Android provides a tool "dx" which allows to convert Java Class files into "dex" (Dalvik Executable) files.
Android applications are packed into an .apk (Android Package) file.
To simplify development Google provides the Android Development Tools (ADT) for Eclipse . The ADT automatically converts from class to dex files and creates the apk during deployment.
Android supports 2-D and 3-D graphics using the OpenGL libraries and supports data storage in a SQLite database.
Every Android application runs in its own process and under its own userid which is generated automatically by the Android system during deployment. Therefore the application is isolated from other running applications and a misbehaving application would not easily harm other Android applications.
Let’s get started!!!

Steps for installation and configuration of the device
1. If you have Eclipse 3.4 Ganymede or greater, proceed to step 2. Else you need to download Eclipse
     Classic from here.
2. Download the Android SDK starter package from here. I recommend that you download the .exe package
     (for Windows).
 If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a location on your  machine. By default, the SDK files are unpacked into a directory named android-sdk-<machine- platform>.
 If you downloaded the Windows installer (.exe file), run it and it will check whether the proper Java SE  Development Kit (JDK) is installed (installing it, if necessary). Then install the SDK Tools into a default  location.
 Make a note of the name and location of the SDK directory on your system—you will need to refer to 
 the SDK directory later, when setting up the ADT plugin for Eclipse.

3. Using Eclipse, install the Android Development Tools. Detailed steps for installing the ADT are given  
    below:
    If you have Eclipse 3.4 (Ganymede):
   a)      Start Eclipse.
   b)      Select Help > Software Updates.
   c)      In the dialog that appears, click Available Software tab.
   d)     Click Add Site.
   e)      In the dialog that appears, enter https://dl-ssl.google.com/android/eclipse in the Location field and
           click OK.
   f)      Back in the Available Software view, you will see the plugin listed with Developer Tools nested
           within it. Select the checkbox next to Developer Tools and click Install.
   g)     On the next installation window, all of the included tools should be checked. Click Next.
   h)     Read and accept the license agreement, then click Finish.
   i)      Once installation completes, restart Eclipse.

Alternatively, if you are using Eclipse 3.5 (Galileo) or Eclipse 3.6 (Helios):
   a)      Start Eclipse.
   b)      Select Help > New Software.
   c)      Click Add in the top right corner.
   d)      In the dialog that appears, enter ADT Plugin in the Name: field.
            Enter https://dl-ssl.google.com/android/eclipse in the Location: field. Click OK.
   e)      In the Available Software view, select the textbox next to Developer Tools and click Next.
   f)      Follow the steps g, h and i listed above.

4. Once the tools have been downloaded, next step is to Configure the ADT plugin.
   a)      Start Eclipse.
   b)      Select Windows > Preferences.
   c)      Select Android in the left hand side list.
   d)     Browse to the location of the Android SDK directory.

   e)      Click OK/ Apply.

5. Now select Window > Android SDK and AVD Manager.


Select Available Packages. Select the latest version of the SDK.


Click Install Selected, confirm license. Once installed, restart Eclipse.

6. Now we need to configure the device which will be used for emulation.
    For that, click the Device Manager button.
    
 
   Select Virtual Devices and click New…         

   

   Enter the following:


Click Create AVD.
To test if the setup has been done correctly, select your device and click Start. 
Have patience. The device takes a long time to start.

Thats it... Now we’re ready to build our first project!!!

No comments:

Post a Comment