How to setup Android SDK on Eclipse IDE

by -

Do you want to develop an Android application. If yes, this guide will help you integrate Android SDK with Eclipse IDE to develop your very first Android application. The integration process has been divided into steps so that process become easy and less cumbersome.

Install Android SDK on Netbeans IDE

Further, I would request to go as per the steps mentioned below to avoid unwanted inconvenience. Also there are some pre-requisites mentioned at the very start of the post which you should take into consideration.

Pre – requisites for Setting up Android SDK:

Operating System

WindowsVista (32- or 64-bit), or Windows 7 (32- or 64-bit), Mac OS X 10.5.8 or later (x86 only)

Java JDK 1.6

(Note: Click on the “Accept License Agreement” Option button above to install the executable file)

Eclipse 3.6.2 (Helios) or greater:

Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. It is written mostly in Java. It can be used to develop applications in Java and Android.

(Note: For Windows Users)

(Note: For Mac Users)

Android SDK :

Android SDK is a software development kit that enables developers to create applications for the Android platform. The Android SDK includes sample projects with source code, development tools, an emulator, and required libraries to build Android applications.

(Note: For Windows and Mac Users)

Step 1: Installing Java JDK and setting up the class path

For Windows Users:

  •  Once you have downloaded the Java JDK from link mentioned above double click on the .exe for installing it on your Windows machine.
  • Click on Start Button and go to My Computer
  • Click on the main hard drive (for most it is C :)
  • Click on the Program Files folder-> Open up the folder called Java
  • Click on the version of Java you downloaded.
  • Open the bin folder
  • Inside the bin Folder look for the file called Java, and right-click on it and go to Properties
  • A new window should pop up giving the properties of the java, there should be an attribute called ‘location’. find the location and copy the path (example: “C:\Program Files\Java\jdk1.6.0_ 25\bin”)
  • Now we have the Path Location, so click the start button again and right-click on the “Computer” and open up the “Properties”.
  • In the left side bar look for “Advanced system settings” and open that up (Click Continue)
  • At the bottom of the popup, Click “Environment Variables…”
  • Set up a new user variable by clicking the top most “New..” button (under the “User variables for xxxxx”)
  • Type the variable name as: Path
  • And for the variable value, paste your location of the javac e:g :- C:\Program Files\Java\jdk1.6.0_ 25\bin
  • Click OK of all three pop-ups and close your System settings panel as well.
  • open up the command prompt again (Click start and type “cmd” in the search, press enter)
  • Type “javac” in the command prompt and your problems should be solved.

For Mac Users:

The Mac Operating System automatically updates latest Java JDK so MAC users can skip this step.

Step 2: Extracting Eclipse

For Windows and Mac Users:

  • Extract the Eclipse folder you have downloaded by Right – clicking on the file and then Select ‘Extract All…’ from the Option Menu.
  • Move the Extracted Eclipse folder to your Main Hard Drive Disk (i.e. C: in most cases)
  • Now, search for the eclipse.exe file inside the Extracted Eclipse folder and double click on it to open the Eclipse IDE.
  • Once you click on the eclipse.exe file you will be prompted to ‘Create a location for your workspace’. Workspaces basically consist of your entire project file which you’ll be creating to store in the location mentioned at this point of time.

(Note: Take a note of it to be able to refer to it later. Also, the current workspace for Eclipse can be switched by using the File->Switch Workspace inside the Eclipse IDE.)

Step 3: Downloading the ADT plug-in

For Windows and Mac Users:

  • Start Eclipse, then select Help > Install New Software….
  • Click Add, in the top-right corner.
  • In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/
  • Click OK
  • Note: If you have trouble acquiring the plug-in, try using “http” in the Location URL, instead of “https” (https is preferred for security reasons).
  • In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  • In the next window, you’ll see a list of the tools to be downloaded. Click Next.
  • 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.
  • When the installation completes, restart Eclipse.

Step 4: Configuring and Downloading the Android SDK

For Windows Users:

  1. To install the Android SDK double click on downloaded Android SDK executable file on your computer.(This step differs for Mac Users)
  2. Remember to take a note of the name and location of the SDK directory on your system as you will need to refer to the SDK directory later, when setting up the ADT plug-in.
  3. Select Available Packages in the left panel. This will reveal all of the packages that are currently available for download from the SDK repository.
  4. Select the package(s) you’d like to install and click Install Selected. (If you aren’t sure which packages to select, read Recommended Packages.)
  5. Verify and accept the packages you want (ensure each one is selected with a green checkmark) and click Install. The packages will now be installed into your existing Android SDK directories.
  6. After you’ve successfully downloaded the ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory.
  7. Now, switch back to Eclipse IDE and select Window > Preferences… to open the Preferences panel. (This step differs for Mac Users)
  8. Select Android from the left panel.
  9. 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.
  10. For the SDK Location in the main panel, click Browse… and locate your downloaded SDK directory.
  11. Click Apply, and then OK.

For Mac Users:

All the above steps are to be performed by Mac Users except for 1 and 4:

  • You’ll able to install the Android SDK by extracting the file mentioned above in the pre-requisites section and then clicking on the “Green color Mascot” which is the official Android logo.
  • Also, Mac users will find the Preferences panel under Eclipse > Preferences

Step 5: Setting up the Android Virtual Devices (Android Emulator)

You can create as many AVDs as you would like to test on. It is recommended that you test your applications on all API levels higher than the target API level for your application.

For Windows and Mac Users:

  •  To start the AVD Manager in Eclipse: select Window > AVD Manager, or click the AVD Manager icon in the Eclipse toolbar.
  • In the Virtual Devices panel, you’ll see a list of existing AVDs. Click New to create a new AVD. The Create New AVD dialog appears
  • Fill in the details for the AVD.
  • Give it a name, a platform target, an SD card size, and a skin (HVGA is default). You can also add specific hardware features of the emulated device by clicking the New… button and selecting the feature. For a list of hardware features, see Hardware options.

Example:

  1. Name: droidX (Note: It should be one single name i.e. droid X is not allowed)
  2. Platform target: Android 2.2 –API Level 8
  3. SD card size: 100 Mb
  4. Skin: HVGA

Note: Be sure to define a target for your AVD that satisfies your application’s Build Target (the AVD platform target must have an API Level equal to or greater than the API Level that your application compiles against).

  • Click Create AVD.

Step 6: Creating an Android Project

After you’ve created an AVD you can move to the next step and start a new Android project in Eclipse.

For Windows and Mac Users:

  • In Eclipse, select File > New > Project….
  • If the ADT Plug in for Eclipse has been successfully installed, the resulting dialog should have a folder labeled “Android” which should contain “Android Project”. (After you create one or more Android projects, an entry for “Android XML File” will also be available.)
  • Select “Android Project” and click Next.

  • The project details can be filled with the following example values:
  1. Project name: TheGeeksClub
  2. Build Target: Select a platform version that is equal to or lower than the target you chose for your AVD.
  3. Application name: TGCWebApp
  4. Package name: com.tgc.web.app (or your own private namespace)
  5. Create Activity: TGCStartActivity
  • Click Finish.

Do let us know about this article in the comment section below.

Courtesy: Android Developer Homepage.

An entrepreneur by birth, blogger by choice, and geek by heart. He founded Sprouts Media, a blogs network company which currently own over 10 popular web properties, to cater his passion of blogging and entrepreneurship. He is also known as an avid reader, technology enthusiast, explorer, and a broken lover. His passion for knowledge keeps him running all the time. He loves to write about Technology and Social issues on his blogs.
  • Minbog9

    thanx beautifully explained,solved my problem…:)

  • Paras Sidhu

    Similiar to this: I downloaded Java SE Dev. Kit and installed it. When I try to install Android SDK, it says that you don’t have Java Dev. Kit installed. I set environment variable also… with name ‘Path’ and value ‘Copied Path’. Also did cmd command and ran it as admin. Can’t Install Android SDK… What to do?

    • Paras Sidhu

      Thank you :) This help worked for me :-)