Wednesday, December 28, 2011

Install and Configure Android in Eclipse


To all curious programmers and newbies, who wants to get their hands dirty in android platform must have these things mentioned below in your system.

a.     Android SDK.
b.     Eclipse - one of the recommended IDE for android development.
c.      JDK - to compile your android code (which will be in java).
d.     ADT plugin for eclipse.

So, how do we get these things into our system?? Ok, will explain step by step about installing and configuring android. First let me detail about downloading android sdk.

Downloading Android SDK

Android sdk requires windows xp and higher versions of xp. Once you are ready with this, you can go ahead and download android sdk from android developers site, here is the link to download http://developer.android.com/sdk/index.html

You can either download zip or .exe file, .exe file is recommended for windows users. Make sure to install it in right path, as we need this path to configure eclipse. Once you are done with downloading SDK move to next step downloading eclipse.

Downloading Eclipse for Android

Eclipse is an IDE used to develop android applications. It provides an easy to use interface and lots and lots of features which makes developer life easy. I am gonna write about using eclipse in another post, for now lets concentrate on downloading eclipse into our system. You can download eclipse from this link 
When you click on this link, you’ll be taken to eclipse website and a list of available eclipse will be displayed. Now here is the confusion. Which IDE to download? To solve the confusion here is the solution. Android recommends few packages,

1.     Eclipse IDE for Java Developers
2.     Eclipse Classic
3.     Eclipse IDE for Java EE Developers

Download any one of the above packages and install. We completed half of the task. Next is to install our favorite JDK.

Downloading JDK (Java Development Kit)

(Skip this step if you already have java in your system. To test, open command prompt and type java –version command. If you are able to see java, then java is already installed in your system and you can save some Bandwidth by skipping this step)
Most of them may be familiar with java, for those who are new to java can download jdk from Oracle site, http://www.oracle.com/technetwork/java/javase/downloads/index.html .

Download the latest available jdk and install in your system. Once done with installation, go to command prompt and type java –version command. If you are able to see java, then java is installed successfully in your system. If you see any error message, don’t panic, if you know that java is installed in your system the error message might simple indicate that path variable is not set for java. Set the path variable and you are done.

Finally we are at the final step of downloading things. Remember we have not yet configured android sdk in eclipse which you guys are waiting for. 

Downloading ADT (Android Development Tools) for Eclipse

ADT is a plugin for eclipse which is essential to use eclipse for android development. How do we download it into eclipse?? We already have eclipse in our system (if not, refer downloading eclipse section above). Open eclipse by clicking ecplise.exe icon from your eclipse installation path. For the first time, it asks for workspace with pre-populated path, if you are happy with that location click ok else change the path and click ok. Eclipse opens and a nice welcome page welcomes you. We are not concerned with this now. What we need is to install ADT plugin. It involves series of steps,

1.     In menu bar, click on help -> install new software.

2.     Install window opens, which looks like this                 

                                                                           

3.     Copy and paste this url, https://dl-ssl.google.com/android/eclipse/ in the text box before “Add” button and click on “Add”.            
        

4.     A pop-up opens and give a name to this url and click ok.                              
Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).



5.         In the Available Software dialog, select the checkbox next to Developer Tools and click Next. If you expand developer tools, you can see what are the addins are being installed into eclipse.

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.
Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
    
    8. When the installation completes, restart Eclipse.

After restarting eclipse click on windows menu, you should see something similar to this.           
               

If you can see Android SDK Manager and AVD Manager options, then we are in the right path.
We are done with installing all the softwares and tools necessary for android development. Now lets configure eclipse to use android sdk.

Configuring Eclipse for Android

It involves modifying the ADT preference to point to the Android SDK Directory.
 1.     Select Window > Preferences... to open the Preferences panel.



 2.  Now you should see Android in your preferences. Eclipse sometime tries to point to android sdk path automatically, if it is not pointing to sdk location then add your sdk location.

 
 
3.     If everything goes right, you will see all the available versions of sdk listed.

4.     Click Apply and ok to save and close preferences.

We are done with installing and configuring android in eclipse. Let’s try and create one simple android application in next post.










No comments:

Post a Comment