Thursday, 21 June 2012

Getting Started with Android Application Development


This post describes how to install the Android SDK and set up your development environment for the first time.

System Requirement:
1.      Supported Operating System:

·         Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
·         Mac OS X 10.5.8 or later (x86 only)
·         Linux (tested on Ubuntu Linux, Lucid Lynx)
o    GNU C Library (glibc) 2.7 or later is required.
o    On Ubuntu Linux, version 8.04 or later is required.
o    64-bit distributions must be capable of running 32-bit applications.


2.      Supported Development Environment:

·         Eclipse 3.6.2 (Helios) or greater.
·         Eclipse JDT plugin (included in most Eclipse IDE packages).
·         For developing Android applications, Android Developers recommend one of these packages:
o    Eclipse IDE for Java Developers
o    Eclipse Classic
o   Eclipse IDE for Java EE Developers

·         JDK 6 (JRE alone is not sufficient).
·         Android Development Tools plugin (recommended)

Ø  Eclipse can be downloaded from http://www.eclipse.org/downloads/
Ø  Read about JDT at http://www.eclipse.org/jdt/



3.      Hardware requirements:

The table below provides a rough idea of the disk-space requirements to expect, based on the components that you plan to use.



Component type
Approximate size
Comments
SDK Tools
35 MB
Required.
SDK Platform-tools
6 MB
Required.
Android platform (each)
150 MB
At least one platform is required.
SDK Add-on (each)
100 MB
Optional.
USB Driver for Windows
10 MB
Optional. For Windows only.
Samples (per platform)
10M
Optional.
Offline documentation
250 MB
Optional.




Download SDK Starter Package:

The SDK starter package is not a full development environment—it includes only the core SDK Tools, which you can use to download the rest of the SDK packages (such as the latest Android platform).

Download the latest version of SDK from http://developer.android.com/sdk/index.html

If you downloaded a .zip or .tgz package (instead of the SDK installer), just unpack it. If you downloaded the Windows installer .exe file, then just run it.

Ø  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 and when using the SDK tools from the command line.


Install ADT Plugin for Eclipse:

Android offers a custom plugin for the Eclipse IDE, called Android Development Tools (ADT) that is designed to give you a powerful, integrated environment in which to build Android applications. Developing in Eclipse with ADT is a highly recommended approach and is the fastest way to get started with Android. Steps to install ADT are as follows:

1.     Start Eclipse, then select Help > Install New Software....
2.     Click Add, in the top-right corner.
3.     In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
4.     Click OK
5.     In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
6.     In the next window, you'll see a list of the tools to be downloaded. Click Next.
7.     Read and accept the license agreements, then click Finish.
8.     When the installation completes, restart Eclipse.



Configure ADT Plugin for Eclipse:

1.     Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
2.     Select Android 
You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and click Proceed. You cannot continue with this procedure until you click Proceed.
3.     For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
4.     Click Apply, and then OK.

 If you haven't encountered any problems, then the installation is complete. Done!


 Adding Platform and Other Packages:

The last step in setting up your SDK is using the Android SDK Manager (a tool included in the SDK starter package) to download essential SDK packages into your development environment.

The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions, add-ons, tools, samples, and documentation—into a set of separately installable packages. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. If you used the Windows installer, when you complete the installation wizard, it will launch the Android SDK Manager with a default set of platforms and other packages selected for you to install. Simply click Install to accept the recommended set of packages and install them.

You can launch the Android SDK Manager in one of the following ways:

·         From within Eclipse, select Window > Android SDK Manager.
·         On Windows,double-click the SDK Manager.exe file at the root of the Android SDK directory.
·         On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:
android

To download packages, use the graphical UI of the Android SDK Manager to browse the SDK repository and select new or updated packages (see figure 1). The Android SDK Manager installs the selected packages in your SDK environment.



1.      Available Packages

By default, there are two repositories of packages for your SDK: Android Repository and Third party Add-ons.
The Android Repository offers these types of packages:
·         SDK Tools — Contains tools for debugging and testing your application and other utility tools. These tools are installed with the Android SDK starter package and receive periodic updates. You can access these tools in the <sdk>/tools/ directory of your SDK. To learn more about them, see http://developer.android.com/guide/developing/tools/index.html#tools-sdk  in the developer guide.
·         SDK Platform-tools — Contains platform-dependent tools for developing and debugging your application. These tools support the latest features of the Android platform and are typically updated only when a new platform becomes available. You can access these tools in the <sdk> /platform-tools/ directory. To learn more about them, see http://developer.android.com/guide/developing/tools/index.html#tools-platform in the developer guide.
·         Android platforms — An SDK platform is available for every production Android platform deployable to Android-powered devices. Each SDK platform package includes a fully compliant Android library, system image, sample code, and emulator skins. To learn more about a specific platform, see the list of platforms that appears under the section "Downloadable SDK Packages" on the left part of this page.
·         USB Driver for Windows (Windows only) — Contains driver files that you can install on your Windows computer, so that you can run and debug your applications on an actual device. You do not need the USB driver unless you plan to debug your application on an actual Android-powered device. If you develop on Mac OS X or Linux, you do not need a special driver to debug your application on an Android-powered device. See http://developer.android.com/guide/developing/device.html for more information about developing on a real device.
·         Samples — Contains the sample code and apps available for each Android development platform. If you are just getting started with Android development, make sure to download the samples to your SDK.
·         Documentation — Contains a local copy of the latest multi-version documentation for the Android framework API.



2.      Recommended Packages:

The SDK repository contains a range of packages that you can download. Use the table below to determine which packages you need, based on whether you want to set up a basic, recommended, or full development environment:

Environment
SDK Package
Basic
SDK Tools
SDK Platform-tools
SDK platform
+
Recommended
(plus Basic)
Documentation
Samples
USB Driver
+
Full
(plus Recommended)
Google APIs
Additional SDK Platforms






Exploring the SDK:

Once you've installed the SDK and downloaded the platforms, documentation, and add-ons that you need, we suggest that you open the SDK directory and take a look at what's inside.

The table below describes the full SDK directory contents, with packages installed.

Name
Description
add-ons/
Contains add-ons to the Android SDK development environment, which let you develop against external libraries that are available on some devices.
docs/
A full set of documentation in HTML format, including the Developer's Guide, API Reference, and other information. To read the documentation, load the fileoffline.html in a web browser.
platform-tools/
Contains platform-dependent development tools that may be updated with each platform release. The platform tools include the Android Debug Bridge (adb) as well as other tools that you don't typically use directly. These tools are separate from the development tools in the tools/ directory because these tools may be updated in order to support new features in the latest Android platform.
platforms/
Contains a set of Android platform versions that you can develop applications against, each in a separate directory.
<platform>/
Platform version directory, for example "android-11". All platform version directories contain a similar set of files and subdirectory structure. Each platform directory also includes the Android library (android.jar) that is used to compile applications against the platform version.
samples/
Sample code and apps that are specific to platform version.
tools/
Contains the set of development and profiling tools that are platform-independent, such as the emulator, the Android SDK Manager, the AVD Manager, ddms,hierarchyviewer and more. The tools in this directory may be updated at any time using the Android SDK Manager and are independent of platform releases.
SDK Readme.txt
A file that explains how to perform the initial setup of your SDK, including how to launch the Android SDK Manager tool on all platforms.
SDK Manager.exe
Windows SDK only. A shortcut that launches the Android SDK Manager tool, which you use to add packages to your SDK.


Once you have completed installation, you are ready to begin developing applications !!!!

We will be back with more tutorials of Android.

No comments:

Post a Comment