Installing Android development environment on Ubuntu 9.04

I wanted to play with writing Android apps on my home Linux computer, which is currently running Ubuntu 9.04 (Jaunty Jackalope). These are mostly notes for myself, so don’t feel guilty if you skip this post. :)

- Make sure your system is up-to-date:

sudo apt-get update && sudo apt-get upgrade

- Install Java

sudo apt-get install sun-java6-jdk

- Switch Sun to be the default version of Java. It’s much faster than the built-in version, at least when I tried it.

sudo update-java-alternatives -s java-6-sun

- Make a directory, e.g. mkdir ~/android

- Download Eclipse from http://www.eclipse.org/downloads/ (I chose the “Eclipse Classic 3.5.1″ version). Move the code into that directory, then unpack it. Unpacking is enough–the software runs in place and doesn’t have to be installed onto the system other than unpacking it.

mv eclipse-SDK-3.5.1-linux-gtk.tar.gz ~/android
cd ~/android
tar xzvf eclipse-SDK-3.5.1-linux-gtk.tar.gz

- Download the latest Android SDK from http://developer.android.com/sdk/index.html and move it into that directory, then unpack it. I believe unpacking is enough–the software runs in place and doesn’t have to be installed onto the system other than unpacking it.

mv android-sdk_r04-linux_86.tgz ~/android/
cd ~/android/
tar xzvf android-sdk_r04-linux_86.tgz

- Edit your ~/.bashrc file and add a line to the bottom:

export PATH=${PATH}:/home/matt/android/android-sdk-linux_86/tools

Okay, now Java, Eclipse, and the Android SDK are installed. Now you need to install the Android Development Tools (ADT) for Eclipse.

- Run Eclipse. If you installed Eclipse in ~/android/eclipse then you can cd to that directory and run ./eclipse to start the program.

- Install the Android Development Tools (ADT) for Eclipse. Follow the excellent instructions at http://developer.android.com/sdk/eclipse-adt.html to get and install the ADT. Don’t forget the “Window > Preferences” step to tell Eclipse where the Android SDK is, so when you click “Browse…” you might navigate to /home/matt/android/android-sdk-linux_86 for example.

- Next, I installed a bunch of packages. In Eclipse, click “Window->Android SDK and AVD Manager.” In the resulting window, on the left-hand side will be an “Available Packages” option. I clicked on that, then clicked the checkbox beside the “repository.xml” package to select all available packages and then clicked “Install Selected.” 12 out of the 14 packages installed for me.

- Now you’re ready to create your first Android program . You’ll discover how to make an Android virtual device (AVD) along the way.

- If you want, you can get custom skins, e.g. a Nexus One skin for Android. You can unpack the .zip file in <your-sdk-directory>/platforms/android-x.y/skins/nexusone for example. Then create a new Android virtual device (AVD) and select the Nexus One as the skin.

- If you want to run your Android program on your own Android device, you’re pretty close. Follow step 10 of this walkthrough. When you’re done and the phone is disconnected from your Ubuntu machine, you’ll still have the executable, called an “android package” or .apk file on your phone. So you can show your friends your “Hello, World!” program. :)

Some resources that I found helpful (other than the official Android developer site) are below:
- http://www.futuredesktop.org/developing_android_apps_on_ubuntu.html
- http://www.softwarepassion.com/setting-up-android-development-platform-on-ubuntu-linux-904/
- http://www.howtoforge.com/installing-google-android-sdk1.0-on-ubuntu8.04-desktop
- http://androidforums.com/developer-101/2321-installing-eclipse-android-sdk-ubuntu-8-04-8-10-a.html
- You might also want to watch this O’Reilly video or some of the official videos.

If you found this post at all interesting, you might also be interested in Google I/O too. Google I/O happens on May 19-20, 2010 in San Francisco.

css.php