Compile Android Kitkat on Ubuntu 14.04

Posted by & filed under Tips.

Android Kitkat logo

Latetly I have been trying to compile Android 4.4 Kitkat from the sources on a raw Ubuntu Trusty Tahr (14.04 LTS).
Sure everyone is looking on Lollipop and its successors these days, but yet a lot of boards do not provide for support for it yet so this might be interesting for someone.

Kitkat was built with toolchains older than the current Ubuntu LTS, so if you religiously follow the instructions you can find on source.android.com or XDA-University, you might encounter some problems. Here is a step by step guide to create your build environment.

Consider it a replacement for the official page named :

Initializing a Build Environment

Setting up a Linux build environment

Installing the JDK

Gingerbread through Kitkat requires Java 6 to compile. Not only they require Java 6 but they require the JVM from Oracle, and not openjdk.

There’s a Launchpad PPA (Personal Package Archive) maintained by webupd8.org, a popular Ubuntu Linux blog, which provides the most recent installers to automatically download and install Oracle Java JDK6/7/8/9 from oracle website.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
sudo apt-get install oracle-java6-set-default

You can check you’re running the correct Java version by running

java -version

Installing required packages (Ubuntu 14.04)

You will need a 64-bit version of Ubuntu.

Here are the necessary package from Google, minus zlib1g-dev:i386 that is not found in the repo.

sudo apt-get install bison g++-multilib git gperf libxml2-utils make zip

Then you will miss these packages (I found out when trying to build), flex is used during the build process, and lib32z1 provides libz.so.1 that’s missing because we could not install zlib1g-dev:i386

sudo apt-get install flex lib32z1

Then you’re all set and can continue through the next step : Downloading the Source

Comments are closed.