With a new version of Ubuntu comes an update to my world-famous guide for setting up a build environment to compile Android ROMs. 14.04 Trusty Tahr is the next Long Term Support edition of the popular Linux distro. The aim of this guide is to simplify the configuration process for you.
Follow the directions step-by-step. All you have to do is copy and paste the code sections in order and you will be up and running in no time!
This guide applies to all variations of Ubuntu 14.04 LTS Trusty Tahr 64 bit. Do not use the 32 Bit version.
Also, PAY CLOSE ATTENTION when to use "sudo" and when to not. It can make things funky if you do something as root that you shouldn't.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
Ready to begin? Ok.
1) Unless it's a completely fresh Ubuntu installation, many of you may have the wrong version of Java installed. Let's fix that first.
The command below makes sure you're starting with a clean slate. Copy and paste it into a terminal (command prompt) window:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
If necessary, follow the on-screen instructions to remove any previous versions. Otherwise, move on to the next step.
It's time to install Java, one of the core pieces for compiling Android ROMs. Depending on which version of Android you are building, you will need the corresponding version of the Java Development Kit.
*** IF YOU ARE BUILDING ANDROID GINGERBREAD THRU KITKAT (2.3 - 4.4.x) USE THESE INSTRUCTIONS FOR JDK 6***
2) Copy and paste the following into the terminal:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 14.04.
3) Now you need to install the package. More copy-paste:
8) Use your favorite text editor to open ~/.bashrc - I like nano:
sudo nano ~/.bashrc
9) At the very bottom (use the Page Down key) paste this code to a new (empty) line:
10) Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash:
11) In the terminal, navigate to where you would like to download the Android source code. The commands below will make it in your home folder, but if you have limited space you may want to create it somewhere else. Faster is better, i.e. SSD would be best, USB external is basically unusable. Here we go:
12) Now you're going to initialize the repo. This is where you decide the flavor of Android you want to build, i.e. AOKP, CyanogenMod, AOSP etc.
For the purposes of the tutorial, here's the command for AOKP KitKat: