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.
Thanks Matt, I’ll give this a shot! Cheers!
Simple and complete. Nice post
Just to point out that obviously Eclipse is optional (for those of us who like text editors terminal-based). I’m not a mobile dev, and the only time I got the Android SDK up and running was when google goggles came out – but I still couldn’t seem to install a copy even in the emulator :-(.
Mat
I like the idea of at least getting some kind of Android App running in a simulation environment on my XP PC. I use the NetBeans IDE for PHP dev mostly, it would be so cool to get Android working on this platform. Then I would love to blog about it.
Andy
Thanks MattοΌ
I was really looking for a good tutorial. thanks a lot π
People like the idea of Android, but dislike that there’s so many versions of it flying around.
FYI: The iPhone SDK is for Mac OS only. π
We know you’re a king “Google Guy”, but have you paid any attention to the Palm webOS? Palm has somehow become the little guy on the field, but they are doing things soooooo right. The NEW Palm is reminiscent of a young Google in a lot of ways.
Good point Geiger, they may be doing things much better especially from a UI standpoint however, the marketing just isn’t generating the same kind of buzz that there is for the Google/Apple phones.
After Google Nexus Android based smartphone many mobile developers are focusing to developed apps for these smartphones. And for Ubuntu its quite diffuclt for them. You have just share impressive lesson. Thanks for sharring Matt
irrelevant but you might be interested to know that http://adwords.google.com is currently stuck in an endless loop.
(although it will probably be fixed by the time you see this, but if not, I am sure you know who to contact to get it fixed)
Any reason this shouldn’t work on my MacBook Air?
@joe c. – You couldn’t be more right! Did you see the ads from Verizon??? “Palm Pre – Smart Enough for your Mom”. Ugh….
Outstanding. I am a long time Win dev and I ordered a Dell laptop with Ubuntu just to do Android dev so I am the noobist of the noobs to this. I followed your post and in no time at all, I had my own ‘Hello Android’. The links you provide will keep me going for a while. Excellent job!
Just wanted to program something for an android phone and this tutorial worked great, thanks.
How come nobody makes (hint, hint) a device that is basically two head sets that will allow headset A to speak in say English and have it automatically translate to headset B’s language, and visa versa? When you travel to foreign countries, as I still do (especially the far east) I often have to hire a translator. Why, given the technology to translate languages from speech, can’t someone market a A-B headset that instantly translates what you’re saying back and forth? I speak, wearing headset A, the person wearing headset B hears what I said in Mandarin. The person wearing headset B speaks in Mandarin and I hear it on headset A in English. I know the translations won’t be perfect, especially when one uses slang or bad grammar, but it would allow one to travel the world without the need of a translator. You’d just have to hand the person you want to converse with headset B, that’s it.
If anyone could pull this off, it would be google. Will this tranlation app let you speak a sentence in English then say it out loud in another language? Can it then have a button to press that lets you hand the phone to the other person so that it translates visa-versa, their language to English?
i know it’s an old post but i was trying to fid a solution and came across this.. java was dead slow so i switched to sun, much better thanks.
@joe.c, @geiger,
Watch out for http://notionink.com , http://notionink.wordpress.com
Does anyone know how to compile an android sdk on Ubuntu if you don’t want to use Eclipse?
Thanks a lot Matt – for sharing this point to point post with good guide links π I really appreciate this tutorial:)