Note: In this tutorial, I'm using Xubuntu 8.04. These steps are the same for Ubuntu and Kubuntu as well. They're also the exact same for [Xu|Ku|U]buntu 8.10.
The first thing we need to do is download all of the needed files. First up, the Android SDK. You can download it from http://code.google.com/android/download.html
We're also going to need Eclipse. Head over to http://www.eclipse.org/downloads/
. The version we want is Eclipse IDE for Java Developers
. The JEE version will work as well.
Next, we're going to need Java. Bring up a terminal window (Applications -> Accessories -> Terminal
). We can install it using apt, by running...
sudo apt-get install sun-java6-bin
(If you're using a 64 bit distribution, you'll also need to install the ia32-libs as well)
Once it's done downloading the files, it will prompt you about the license.
Press tab, and then enter. It will tell you that you have to accept the license to continue, and then prompt you again. Select yes, and press enter to continue.
Now that Java is installed, we can get started on Eclipse. First, let's untar/gzip Eclipse. In our terminal window...
And then untar/gzip the file.
tar xvfz eclipse-jee-ganymede-SR1-linux-gtk.tar.gz
Finally, move it into your home folder.
mv eclipse ~
Now, if you want to add eclipse to your menu, right click on Applications and Edit Menu. Click on Programming, and then click New Item. Type in the name, and the full location to Eclipse (/home/yourusername/eclipse/eclipse), and finally, click OK.
Personally, I just made a launcher for it on my Desktop.
Now, let's extract the Android SDK. Back in the terminal again...
Let's move the resulting folder into our home folder.
mv android-sdk-linux_x86-1.0_r1/ ~
Now, this is the single most important step
. Without this, we'll encounter all sorts of odd problems later. Open up your ~/.bashrc in your favorite editor (because I'm doing this in Xubuntu, I'm using mousepad. You can use whatever you'd like.)
sudo mousepad ~/.bashrc
And we're going to add the following at the bottom of the file (making sure you replace yourusername with your actual username.)
Save the changes, and exit your editor. Now, we can start up Eclipse.
Eclipse will prompt you to choose a workspace location.
This is where all of your project files will be stored. Set it where you want, and click OK.
Once Eclipse is started up, we can add the ADT plugin. In the menu, Help -> Software Updates
Click on the Available Software tab, and then Add Site. For the location, we're going to enter http://dl-ssl.google.com/android/eclipse/
And click OK. Eclipse will go find the list of available software, and update your list.
Click the checkbox next to the Location we just added to select all of the software, and click Install.
Eclipse will calculate all of the requirements and download the needed files. Then you'll be greeted by the Install window.
Click Next to install the selected tools. You'll be asked to agree to the license.
Accept the license agreement, and then click Finish. Eclipse will install everything...
...And then will prompt you to restart, click Yes. Eclipse will restart.
The last thing we need to do is point the ADT plugin to our Android SDK folder. In the top menu, go to Window -> Preferences
, and then click on the Android tab.
Click Browse, choose the Android SDK folder, and then click OK. Now click Apply and let Eclipse crunch on it for a second or two.
And click OK. You're finished!
To run a quick test and make sure everything is working properly, go to File -> New -> Project
. Expand Android, click on Android Project, and click Next.
Now we'll have to fill in our project information. Because this is a test run, we'll call the project testrun. For the package name, we'll use com.android.test. And last but not least, the activity name will be test.
Eclipse will crunch on that for a second, and open the project in the left pane. Expand the main tree to see the file structure of a default new project. The last thing we need to do before we run our test application is set up a run configuration. In the menu, go to Run -> Run Configurations...
Double click on Android Application and it will create a new configuration. Give the configuration a name, and click browse for the project.
Choose your project, click OK. Now click Apply, then Run.
You'll notice the bottom pane switches over to Console. This will let you know what's going on with the emulator. After a few seconds, the emulator will start up.
Note that the first run will take *much* longer than usual to start up, as it's setting up the Android OS while it starts up for the first time. Depending on the specs of your computer, it can take anywhere from a few minutes to over half an hour.
After awhile, you'll arrive at the starting screen. Usually, you'll get a few errors as things start up and can't be started.
I usually just click wait. In the console, you'll see it install, and then start up your application.
And with that, it's time for you to dive into the code and start making your application.