Sunday 25 August 2013

Android Installation on Windows7 and Creating a Simple Hello World Program

What Is Android ?Android is an operating system for mobile devices. Applications developed for Android are written in Java programming language.


How do I setup the enviornment for developing applications on Android?To setup the environment , follow these simple steps:
1) Identify the operating system on your PC. Verify whether it is listed in the “Supported Operating Systems” section. Click on this link to verify http://developer.android.com/sdk/requirements.html
2)  Applications for Android are written using Java programming language.Set up the environment to “DEVELOP” Java Programs.
If you have to only run Java programs, then install Java Runtime Environment(JRE). But we will be developing programs, so install Java Development Kit(JDK) which includes JRE . There is no need of separate installation of JRE if JDK is installed.
Note: Identify the operating system and choose the correct version of JDK.Click on below link to install JDK : http://www.oracle.com/technetwork/java/javase/index-137561.html
3) Surely you won’t write programs in Notepad. You will use an IDE(Integrated Development Environment) to code your applications. Preferred IDE would be Eclipse, but applications can be developed using other IDEs.
To install Eclipse , select proper version of Eclipse(3.5 or newer).
Click on below link : http://www.eclipse.org/downloads/
4)  To code applications , download the Android SDK . Android SDK provides tools and APIs to develop programs for Android OS. Download the Android SDK from this link : http://developer.android.com/sdk/index.html
5)  Your installed Eclipse IDE should be capable of developing Android programs. So install the ADT plugin for Eclipse. Click here to install the same : http://developer.android.com/sdk/eclipse-adt.html#installing
6) This is last but very important step. Install the essential platform components to complete the installation. This is done using Android SDK and AVD Manager which is installed once you install the SDK.
The above steps may differ depending upon your previous installations if you were developing Java programs. You can log on to http://developer.android.com/guide/basics/what-is-android.html to know more .
In my case , JDK was installed on D drive and the Android SDK on E Drive. I followed the above steps with simple but important settings.You can relate the above steps to screenshots given below.
Step 1 : Operating System : Windows 7 64 bit

Step 2 : JDK Installation Folder: D:\JavaInstallations\JDK . Set the PATH variable to point to JDK installation.
JDK
Step 3,4 : Android SDK zipped package and Eclipse zipped package unzipped at folder location : E:\Programs\Android\Software
Android

Step 5 : Open Eclipse. Select Help-> Install New Software . You will come across the below window. Enter the remote site name http://dl-ssl.google.com/android/eclipse/  . Select the checkboxes and complete installation . Click this link for any problem.. http://developer.android.com/sdk/eclipse-adt.html
 InstallADTPlugin
Step 6 :

SDKManager
a) Android SDK and AVD Manager to install the remaining components. My folder location of this manager is E:\Programs\Android\Software\android-sdk_r08-windows\android-sdk-windows .
Run it and select all to install. After Installation, i could see all the installed packages .
InstalledPackages
Now lets just create a Simple project in Eclipse real quick:
1) Open Eclipse.Click on the eclipse symbol to load Eclipse.
Eclipse
2) Set the workspace. It is place to store your programs. On File Menu .. Select New -> Project. You will come across below screen.
AndoidProject

NOTE: In my case, I had to set the Location of Android SDK in Preferences, so as to let the eclipse locate the Android Tools and APIS for development

Preferences

3) Set the Project Name(on top.. hidden in image), Application Name, PackageName(can be of any order), Activity.. setting Min SDK version is not mandatory.

NewProjectDetails
4) You will see a folder structure with some default code.
JavaEclipseHellofolderStructure
4) Run the Application AS Android Application.
RunASWindow

5) Do not worry, There will be many windows popping up.. but they will start the EMULATOR or SIMULATOR which will run the program.

AndroidEmulator

6) Click on Menu.. You should see HelloWorld … Not magic :) Hello World Code is already written to get u started.. :)

HelloWorld2

0 comments:

Post a Comment