Lesson 1: Setting up your programming environment for Android development

The process to setup a programming environment is not always easy (or fun). It's just a necessary evil in order to start being creative. There are 4 main steps we will walk through here (Don't worry if you do not understand what they "mean"):

1. Install the Eclipse "IDE"
2. Install the Android "SDK"
3. Install the Android Plug-in for Eclipse
4. Configure the Android Plug-in in Eclipse
5. Install the latest Android Platform
6. And finally, write some darn code!

...And One thing I should mention before I launch into explaining how to set all of this up: many of the tools we will be using will be "open source". They are Great tools for programming - not the least of which because they are completely free. BUT - since they are maintained for free by lots of different people all over the world - they change a lot. If something doesn't work while you are following these instructions it might not be that you are doing something wrong. It might be that something has changed (or that I forgot to write a step down) :). If you are stuck - please contact me at doug@somewhatfriendlygames.com and I will try to help you.

First step - install the Eclipse "IDE". An IDE is a fancy way of saying this is a tool which allows you to write code for some language (C++, C) and platform (Windows, Linux, etc). Microsoft's IDE, for example, is called Visual Studio. Eclipse is a free, open source IDE that is Extremely popular (especially in the Java community) and can be used for writing code in Lots of different environments and languages.

This is the Eclipse download page:
http://www.eclipse.org/downloads/packages/release/galileo/sr2

I have already mentioned that open source projects change a lot. They are also sometimes... well - chaotic. This is one great example. An astute student will notice that the above link is Not the latest version of the Eclipse IDE. Careful reading of Google's documentation materials for programming with Eclipse explicitly state that the newer versions of Eclipse are known to be unstable with Android. Yes. This is lame. Yes. Programmers deal with this sort of thing all the time.

BTW, if you are curious - here is Google's developer site for Android.
http://developer.android.com/index.html)
Do not feel intimidated if you dig into this site and are quickly lost. Patience grasshopper.

Let's go ahead and install the "Eclipse IDE for Java Developers". After Eclipse is done downloading - if you open up the zip file, you will find a folder labelled eclipse. Merely copy the folder on to the USB drive that has been given to you. That's it - apparently - Eclipse does not have a formal "installer" at this time (another exciting chapter in using open source software!).

If you run the eclipse.exe in this copied folder - you should see the Eclipse splash screen launch and the program will begin. Since this is your first time to run Eclipse, it will ask you where you'd like to keep your "workspace". This will be the folder you store all the code we develop in this class. This first time we will create our workspace directory - after this, all you will have to do is browse to your workspace folder on your USB drive.

1. Click Browse and Navigate to the your USB Drive
2. Press the button to make a new folder and call it something like... oh, I don't know: Workspace
3. You can then select this folder as your workspace folder

Once you have confirmed that Eclipse Will run and all is happy with the world, lets move on and download and save the Android SDK to your local system. The download can be found here:
http://developer.android.com/sdk/index.html

Make sure and select the download for the Windows version of the SDK. Once downloaded - you should extract the main sdk directory (it will be called something like: android-sdk-windows) inside the zip and save it to your USB drive.

Now it's time to install the Andrioid plug-in for Eclipse. This plug-in will give us a lot of tools that make developing for Android in Eclipse a lot easier. If you are curious why this step couldn't have been combined with installing the SDK... It's a good question. :)

Note: I stole the following (numbered) steps for installing the ADT Plug-in from this page: http://developer.android.com/sdk/eclipse-adt.html - I could just point you there - but I think it is far more digestible to have all the necessary steps on one page.

1. Start Eclipse, then select Help > Install New Software.
2. In the Available Software dialog, click Add....
3. In the Add Site dialog that appears, enter a name for the remote site (for example, "Android Plugin") in the "Name" field. In the "Location" field, enter this URL: https://dl-ssl.google.com/android/eclipse/
4. Click OK.
5. Back in the Available Software view, you should now see "Developer Tools" added to the list. Select the checkbox next to Developer Tools, which will automatically select the nested tools Android DDMS and Android Development Tools. Click Next.
5. In the resulting Install Details dialog, the Android DDMS and Android Development Tools features are listed. Click Next to read and accept the license agreement and install any dependencies, then click Finish.
6. Restart Eclipse.

Once you've successfully downloaded ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory:

1. Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
2. Select Android from the left panel.
3. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
4.Click Apply, then OK.

I know what you're thinking at this point. OMG this is a long process and there is no way I'm going to get this right. Hehe. If it makes you feel any better. I'm a seasoned programmer and even I'm getting agitated at this point. Don't worry. We'll get through it. Somehow.

Once you've installed Eclipse, the SDK and the Plug-in... you need to go to your SDK directory and find the file named: SDK Manager.exe. Believe it or not - you need to launch this so you can install the Lastest version of the Android "Platform" At the time of this writing - Android is up to version 2.2. The manager should pretty quickly launch a screen which shows you all the packages you can install. You should not have to change anything. Click "Install".

Now... You wait. This part of the process is ridiculously slow. If you're doing this in class, we'll probably have a discussion as a group while we all wait for this to finish.

Once this is done - restart Eclipse One. More. Time.

Now. Home Stretch. I Promise. We're finally to the point in the process where we're ready to make a program! Follow the instructions on the following link to get your very own Android phone emulator working on your computer and running a sample program (it will mention that you need to "Install a Platform" in the first step... you've already done that. Start at the step labelled "Create an AVD")

http://developer.android.com/resources/tutorials/hello-world.html