Setting Up Your Android Development Environment
Posted by Matt Cashatt on 4/25/2011 (Last updated on 5/4/2011 3:00 PM)
This tutorial walks you through the steps you need to take to get up and running so that you can begin to develop Android applications. You can use a number of different platforms (Windows, Linux, Mac) and all of the tools you need are free.
1- Get the Java Development Kit
First thing you need to get is the Java Development Kit. This is available on the Sun Microsystems website. You are going to be looking for Java Standard Edition JDK 5 or 6 and on the site you will be able to find installation info for your particular OS. Click this link to get the Java Development Kit. You will probably see two options for the standard edition: "JDK" & "JRE". Ultimately, you need both but you may already have the Java Runtime (JRE) on your machine as this is what is used to run Java code for applets and such. Just try to install them both.
2- Get the Eclipse IDE
Your actual code for your Android application can be written in the free Eclipse IDE. Download Eclipse for Java EE Developers here.
Note that Eclipse does not come with an installer. You will be downloading a zip folder which will need to be unzipped and placed into your preferred directory. There will be a readme file in the zip folder for your particular OS. For my particular Windows installation, I just placed the "eclipse" root folder contained in the zip I downloaded on my C drive (C:\eclipse) and then opened the folder and right-clicked on the eclipse application file to send a shortcut to my desktop so I could launch eclipse from there.
3- Install the Android SDK
The Android software development kit is available for free download here. This SDK includes Android application framework classes, documentation, tools, etc. You have the option of downloading a zip file or an installer (exe file). I recommend the installer, it's much easier. Just download it, double-click it and then follow the wizard.
NOTE: If you are running the SDK on a Windows machine then you have one more step before the SDK is ready to go. You need to update the PATH variable in your Windows system variables. Here are the steps (may vary slightly from version to version of Windows):
1- Right-click on "Computer" and then click "Properties".
2- Click "Advanced System Settings" and then select the "Advanced" tab.
3- Click the "Environment Variables" button.
4- In the "System Variables" section, look for a variable named "Path" and double-click it.
5- In the "Variable Value" textbox, go to the end of the string and add a semicolon followed by the path to your Android tools folder (example: "C:\Program Files (x86)\Android\android-sdk-windows\tools").
6- Click "OK" three times to exit all of the Windows system dialogs.
4- Install and configure the Android Plug-in for Eclipse
The Android plug-in for Elcipse integrates the Android tools into the Eclipse IDE seamlessly. In order to install this plug-in, you are going to have to run an Eclipse update. The steps to do this will vary depending on the version of Eclipse that you have so if you get lost, visit the this page on the Android Developer website. Here are the steps you need to follow for Eclipse version 3.5 (Galileo):
1- Launch Eclipse. NOTE: The first time you launch Eclipse, you will get a dialog asking for the location of your default workspace (example: "C:\Users\Matt Cashatt\workspace"). This is where all of your Android projects will be stored. So just set the location that you want, check the box by "Set this location as default. . ." and click "OK".
2- Go to "Help" in the toolbar and then select "Install New Software".
3- You will probably already be in a screen titled "Available Software", but if not, select the "Available Software". Now click the "Add" button.
4- Add the remote site "https://dl-ssl.google.com/android/eclipse/". If this site fails, then just drop the "s" from http and try again. You can name the site whatever you want. I named mine "AndroidSDK".
5- If everything went ok, Eclipse should have found "Developer Tools" on the remote site and listed it for you with a checkbox. Check the "Developer Tools" box.
6- Click "Next" and then follow the instructions for installing the tools. At the end, accept the license and terms and then click "Finish".
7- After the software update is complete, re-start Eclipse for the changes to take effect.
5- Update Eclipse Preferences to point to the Android SDK
Phew! Almost done. The last step is to point the Eclipse IDE to the Android SDK:
1- Launch Eclipse.
2- Click "Window" (or "Eclipse" on Mac), then "Preferences".
3- Select "Android" in the tree on your left and you will then see "Android Preferences" on your right. Now point to the file path of your Android SDK Installation (example: "C:\Program Files (x86)\Android\android-sdk-windows"). If you now see a bunch of target SDK versions listed, then you did everything correctly and Eclipse has found the SDK. If this is not the case, then check your file path.
Let's do this!
Hope this tutorial helps you to get up and running with Android. If you have any questions, comments, or suggestions, either leave a comment below or contact me. Also, if you develop a killer app, let me know!