Friday, April 13, 2012

Setting up the android environment with eclips






Before starting anything first we need to setup environment. Follow the simple steps to install all the prerequisites for android development. 
Click here for minimum system requirement 
1. Download and install JDK 1.6 or latest . you can get it from here
2. Download and install Android SDK and AVD, you can get it from here
3. Download Eclips, you can get it from here
4. Get the Eclips plugin for android.

Lets look at each step in detail


1. Installing JDK 1.6

You can get latest JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Download it and install if you do not have latest SDK. 

2. Installing Android SDK

First, we need to download the Android SDK.  You can get it here (just select your operating system).  Untar or Unzip this and put it in a folder of your choice (note the folder location, we’ll need it later).  Ironically, the latest Android SDK does not actually come with an Android SDK.  This is a little bit confusing, but Google is trying to provide us with tools to keep up to date instead of just giving us the actual SDK.  What that means for right now, however, is that we have a little bit more work to do before we actually have the SDK.  Go into the unpacked Android SDK folder and you should see a folder named Tools.  Open that and run the “Android” you find in this folder.  This should bring up the Android SDK Manager.

 If you click on Available Packages there should be a repository listed (in mine it lists https://dl-ssl.google.com/android/repository/repository.xml).  Check the repository and click on refresh.  It should give you a list of available Google APIs and Android SDKs.
If you get an error about not being able to access the repository via HTTPS click on the Settings Menu on the left.  Put a checkmark next to Force https://… sources to be fetched using http://… and click Save and Apply.  Go back to Available Packages and click refresh again.  Put a checkmark next to the SDK you want to install, and click install selected.  The SDK version you want is going to be determined by what is installed on your Android device (or your consumer’s android devices).  If you don’t know, just get the latest for now.  You can always come back and get other versions.
After it finishes downloading you should see the SDK listed in Installed Packages.



2. Installing Eclipse

Eclipse is a free, open source IDE. Basically, an environment that will give you everything you need to get started programming in Java. Now you might be saying, “Wait a minute! I want to program in Android, not Java!” Your Android programs are going to be written in Java and run by a Virtual Machine on the Android device. Just think of Android as the framework and Java as the programming language you use to access the framework.
You can download Eclipse by going here and clicking on “Eclipse IDE for Java Developers” on the page.  I am not giving you the direct download link because Eclipse is multiplatform and clicking on that link will take you to the correct version of the software.  You might not want the 64 bit Ubuntu version of the software that the link provides me.  At the time of this writing, the current version of Eclipse is Galileo (version 3.5).
Now untar or unzip Eclipse and run it directly from the folder (there is no need to install anything).  It will ask you for a workbench location.



You can safely accept the default value and just click OK here.
At this point you will be at a welcome screen for Eclipse.  It has a link for an overview of Eclipse, and another for Tutorial on using Eclipse.  If you have never used Eclipse before it might be a good idea to check these out.

3. Get the Android Eclipse Plugin

To get setup for Android development, we are going to open the help menu and select “Install New Software”.  On this screen click Add.  In the window that pops up put in a name for your reference (I just used “Android SDK”) and the URL https://dl-ssl.google.com/android/eclipse/



When you click OK there should be an entry for “Developer Tools” in the list.  Click the checkbox next to this and click on Next.  You will see a screen listing what is going to be installed (Android DDMS and Android Development Tools).  Click Next again, read the license agreement.  If you accept the agreement and click finish then you should see the software install into your Eclipse environment.  Finally, you should get a message recommending that you restart Eclipse.  Tell it to restart.
After you restart click on the Window menu and select Preferences (Eclipse Menu and Preferences if you’re on a Mac).  Click on Android and you will probably get a message complaining that Eclipse doesn’t know where the SDK is located.  Click on browse next to SDK Location and browse to the folder where you saved the SDK earlier.  Click Apply and you should see Android and the Version of the SDK you selected under Target Name.  Click OK.
Now the final step in setting up your Plugin is making a Virtual Device.  Under the Window Menu you should see Android SDK and AVD Manager.  This is a shortcut to the same Android SDK Manager we accessed earlier by running the Android executable in the SDK folder.  Click on Virtual Devices and Click on the New button on the right.  Give this whatever name you like (I called mine DebugAVD since that is how I will be using it) and select your SDK from the Target drop down.  Click on Create AVD and you should get a confirmation message.  Your AVD should now be listed on this screen.
That’s it, you’re ready to go.  Go to File, New, Project and you will see an Android folder.  Expand the folder, click on Android Project.  Fill out the form here, click finished, and you’ll be ready to program.

 Thats it !!!!. Now you are ready to do a magic with Android.

No comments: