Tuesday, 9 December 2014

Android Environment Setup

System requirements:

Operating Systems

·         Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
·         Mac OS X 10.8.5 or later
·         Linux 64-bit distribution capable of running 32-bit applications
·         GNU C Library (glibc) 2.11 or later is required.
·         Tested on Ubuntu 12.04, Precise Pangolin

Development tools

·         JDK 6 (JRE alone is not sufficient)
·         Apache Ant 1.8 or later
·         Not compatible with Gnu Compiler for Java (gcj)

Note: Some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are not supported for Android development.

Setup Java Development Kit (JDK)

You can download the latest version of Java JDK from Oracle's Java site: http://www.oracle.com/technetwork/java/javase/downloads/index.html. You will find instructions for installing JDK in downloaded files, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively. 
If you are running Windows and installed the JDK in C:\jdk1.6.0_15, you would have to put the following line in your C:\autoexec.bat file. 
set PATH=C:\jdk1.6.0_15\bin;%PATH%
set JAVA_HOME=C:\jdk1.6.0_15

Alternatively, you could also right-click on My Computer, select Properties, then Advanced, then Environment Variables. Then, you would update the PATH value and press the OK button.
On Linux, if the SDK is installed in /usr/local/jdk1.6.0_15 and you use the C shell, you would put the following code into your .cshrc file.

setenv PATH /usr/local/jdk1.6.0_15/bin:$PATH
setenv JAVA_HOME /usr/local/jdk1.6.0_15
Alternatively, if you use an Integrated Development Environment (IDE) Eclipse, then it will know automatically where you have installed your Java.

Installing the Eclipse ADT Bundle

The Eclipse ADT Bundle provides everything you need to start developing apps, including the Android SDK tools and a version of the Eclipse IDE with built-in ADT (Android Developer Tools) to streamline your Android app development.

If you didn't download the Eclipse ADT bundle, go http://developer.android.com/sdk/index.html.

To set up the ADT Bundle:

1.       Unpack the ZIP file (named adt-bundle-<os_platform>.zip) and save it to an appropriate location, such as a "Development" directory in your home directory.
2.       Open the adt-bundle-<os_platform>/eclipse/ directory and launch Eclipse.
Caution: Do not move any of the files or directories from the adt-bundle-<os_platform> directory. If you move the eclipse/ or sdk/ directory, ADT will not be able to locate the SDK and you'll need to manually update the ADT preferences.

Eclipse with ADT is now ready and loaded with the Android developer tools, but there are still a couple packages you should add to make your Android SDK complete.

Adding SDK Packages

By default, the Android SDK does not include everything you need to start developing. The SDK separates tools, platforms, and other components into packages you can download as needed using the Android SDK Manager. So before you can start, there are a few packages you should add to your Android SDK. Click here to download Android SDK http://developer.android.com/tools/help/sdk-manager.html 
To start adding packages, launch the Android SDK Manager in one of the following ways:
·         In Eclipse or Android Studio, click SDK Manager  in the toolbar.

·         If you're not using Eclipse or Android Studio:
      • Windows: Double-click the SDK Manager.exe file at the root of the Android SDK directory.
      • Mac/Linux: Open a terminal and navigate to the tools/ directory in the Android SDK, then execute android sdk.

When you open the SDK Manager for the first time, several packages will be selected by default. Leave these selected, but be sure you have everything you need to get started by following these steps:

Once you launched SDK manager, it’s time to install other required packages. By default it will list down total 7 packages to be installed, but I will suggest de-selecting Documentation for Android SDK and Samples for SDK packages to reduce installation time. Next click Install 7 Packages button to proceed, which will display following dialogue box:


If you agree to install all the packages, select Accept All radio button and proceed by clicking Install button. Now let SDK manager do its work and you go, pick up a cup of coffee and wait until all the packages are installed. It may take some time depending on your internet connection. Once all the packages are installed, you can close SDK manager using top-right cross button.

Setup Android Development Tools (ADT) Plugin

This step will help you in setting Android Development Tool plugin for Eclipse. Let's start with launching Eclipse and then, choose Help > Software Updates > Install New Software. This will display the following dialogue box.


Now use Add button to add ADT Plugin as name and https://dl-ssl.google.com/android/eclipse/ as the location. Then click OK to add this location, as soon as you will click OK button to add this location, Eclipse starts searching for the plug-in available the given location and finally lists down the found plugins.


Now select all the listed plug-ins using Select All button and click Next button which will guide you ahead to install Android Development Tools and other required plugins.

Create Android Virtual Device

To test your Android applications you will need a virtual Android device. So before we start writing our code, let us create an Android virtual device. Launch Android AVD Manager using Eclipse menu options Window > AVD Manager> which will launch Android AVD Manager. Use New button to create a new Android Virtual Device and enter the following information, before clicking Create AVD button.


If your AVD is created successfully it means your environment is ready for Android application development. If you like, you can close this window using top-right cross button. Better you re-start your machine and once you are done with this last step, you are ready to proceed for your first Android example but before that we will see few more important concepts related to Android Application Development.


No comments:

Post a Comment