I’ve been developing cross platform apps using HTML5 for deployment across Desktops, Tablets, and Phones. Lots of interesting apps can be built without talking to the hardware but sooner or later, we always want to go deeper. Mozilla is working Won an exciting “Web Runtime” ( read more here ) and there is a version of Firefox for Android.

Though I don’t want to build native Android Apps, I do want to get under the covers and experiment with building the Open Web Apps runtime components (it’s so cool working for an organization where EVERYTHING we build is open source and available for download WHILE it’s being developed.)

Since I hit a couple of snags getting things set up I though I’d share the steps that I used in the hopes that it would help someone else who is just getting started.

Though there are good commercial Java / Android Development tools available, the standard is to use Eclipse and the ADT, so that’s what I’ll be setting up in the steps below.

Eclipse is itself a Java App. On my Ubuntu machine the default Java Runtime was OpenJDK which is not recommended for running Eclipse.

So the first thing that we want to do is make sure that we have our Ubuntu system up to date, the latest version of the Java run-time and JDK installed and our Ubuntu box configured to use the Sun versions by default.

Start by opening up a terminal window.

If you are brand new to Ubuntu you can find any application (including apps you haven’t yet installed) by using the Unity Launcher Bar

The Ubuntu Unity Task Launcher

  1. Click on the Ubuntu App Button on the top.
  2. Start typing the name of the application you are looking for.
  3. If it appears in Installed Apps – click to run it. If it appears in available apps, install it.

Terminal will be installed. Click on it to run.

sudo apt-get update

Enter your password when the sudo command in the terminal prompts you for it.

Leave the terminal window open when the command completes.

Next run upgrade.

sudo apt-get upgrade

Now we need to get the Java JDK

You can install it from your open terminal:

sudo apt-get install sun-java6-jdk

The command above installs only the JDK. I wanted to make user everything Java was installed on my machine and up to date to avoid problems with unresolved dependencies later on so I ran this command:

sudo apt-get install sun-java6-bin sun-java6-jre

sudo sun-java6-jdk sun-java6-plugin sun-java6-source

You can run them all at once but I broke them up for formatting here on my blog.

Now we want to check and confirm that Java and the JDK / Java Compiler installed and being used are the latest. This is necessary because you can have as many different versions installed on your machine but only one will be the default.

java -version

javac -version

And you should see something like this.

Check Java Versions on Ubuntu

Check Java Versions on Ubuntu

If some other version appears (like the Open JDK) then you can change the default by running this command and choosing the version that you just installed.

sudo update-alternatives --config java

Once done, we need to instal lthe Adroid SDK.

Get it here : http://developer.android.com/sdk/

Downloading the Android SDKDownloading the Android SDK

You can decompress the files and place them in a location that makes sense for your Linux usage.

I put mine in /usr/apps/android-sdk

We also want to add the Android SDK to our shell path.

To do this, open a Nautilus instance (File Explorer) and navigae to your Home directory.

/home/joesstagner” in my case.

Then use the menu to select View->Show Hidden Files

Ubuntu Show Hiden FIles

Ubuntu Show Hiden FIles

Find the .bashrc file and open it with the text editor of your choice.

Append the following line, changing the entry to reflect the location that you chose for the Android SDK

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

Save and close the file.

Now we can install Eclipse.

There are two ways that you can do this – but the important part is that you install “Eclipse for Java Developers“.

If you install the bare bones version of Eclipse you may find yourself in dependency hell when you try to set Eclipse up for Android.

You can download Eclipse for Java from www.eclipse.org

Download Eclipse for Java

Download Eclipse for Java

In my case I will use Ubuntu’s synaptic package manager to install Eclipse.

You can find and run the Synaptic Package Manager using the technique referenced above.

Install Eclipse with the Synaptic Package Manager on Ubuntu

Install Eclipse with the Synaptic Package Manager on Ubuntu

Note that I installed both Eclipse and Java development components.

Now we are ready to download and install the Eclipse plugin for Android Development.

1. Start Eclipse, then select Help -> Software Updates….
2. In the dialog that appears, select the Available Software tab.
3. Click Add Site…
4. Enter the Location: http://dl-ssl.google.com/android/eclipse/

Note: It’s probably better to use https for the download but I had problems in doing so.

Add the Android Developer Tools to Eclipse

Add the Android Developer Tools to Eclipse

Then select the tools :

Add ADT - Select Tools

Add ADT - Select Tools

Click next until you get to the EULA and agree to it (click yes)

Eclipse will download and install the ADT.

Installing the Android Developers Kit - ADT

Installing the Android Developers Kit - ADT

You may see a warning that the code to be downloaded is unsigned.

ADT Unsigned Security Warning

ADT Unsigned Security Warning

I chose to install anyway.

When everything is installed, Eclipse will prompt you to re-start Eclipse.

Restart Eclipse

Restart Eclipse

When you restart, Eclipse may ask you about updating the Android SDK

Eclipse Add Reference to Android SDK

Eclipse Add Reference to Android SDK

Eclipse will ask you a couple of permission questions – say yes.

When it’s all done we can select New -> Project

New Android Project in Eclipse

New Android Project in Eclipse

Now we’re ready to start building an Android App !