Setting up the Build Environment
First things first: you need to download and install 64-bit version of Ubuntu 12.04. A 32-bit one won't cut it.
Installed it? Good, let's move on.
Now do a system update; click that little switch icon in the top right hand corner and you'll get a menu. Launch Update Manager and install everything it finds.
Now that your Ubuntu is up to speed you need to download and install some more stuff. Launch the terminal (Ctrl + Alt + T).
Copy the below code and paste it (right-click and paste or Shift + Insert, Ctrl + V doesn't work) in the terminal, hit enter.
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl pngcrush schedtool g++-multilib lib32z1-dev lib32ncurses5-dev libxml2-utils
If 'lib32ncurses5-dev' fails, delete it from the list, install everything else.
Now you need to add the following repos, again copy/paste each line into the terminal, hit enter. Repeat for each line of the code below.
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy main multiverse"
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu hardy-updates main multiverse"
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
Now you are going to install Synaptic.
sudo apt-get install synaptic
Click the 'Dash Home' button (top left hand corner of your desktop), find and launch Synaptic Package Manager. Search for 'Sun Java6 JDK' and install it will all the dependencies except sun-java6-demo and sun-java6-doc.
Now go to http://developer.android.com/sdk/index.html
and download the linux version of the Android SDK. It provides the API libraries and developer tools necessary to build. When your download is done, open it with Archive Manager, extract it somewhere, and move the extracted folder to your Home folder. Rename it to 'SDK' for simplicity.
Now you need to download and install Android SDK Platform Tools. Use file manager to navigate to your SDK sub-folder Tools. Find 'android' and double-click to run it. You'll be asked what you want to download. Choose the 'Platform Tools' and the Android 4.1.2 SDK Level 16 and the Android 4.2 SDK level 17 Dev tools and hit install. Let it download; it might take some time, depending on your download speed.
Now the time is ripe for you to setup your Android repos. Copy/paste the following commands into the terminal, hit enter after each one.
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
You have to reboot after this for changes to take effect.