24 October 2008

Building Google's Android on 64-bit Linux

This week Google released the sources for all the open-source components of Android including the kernel, the frameworks, the SDK, and most, but not all, of the bundled apps.

My laptop is a dual boot system that mostly runs Windows, but Linux and OS X are the only supported Android build environments, so I fired up Linux (64-bit Ubuntu 8.04 Hardy Heron). Things don't quite build out of the box for 64-bit Linux, so here are some tips to get you going.

In addition to the dependencies listed at http://source.android.com/download#TOC-Linux you'll also need the following:
$ sudo apt-get install ia32-libs g++-multilib gcc-multilib lib32z1-dev lib32ncurses5-dev
There's an additional problem with a missing softlink to the 32-bit version of the X11 client library that you can resolve as follows:
$ cd /usr/lib32
$ sudo ln -s libX11.so.6 libX11.so
It really ought to be included in one of the standard packages, but doesn't seem to be on Ubunto (the shared library itself is included in ia32-libs however).

Follow the rest of the directions on the Android site to install their repo tool (and git if you don't have it), fetch sources, and then do
$ cd ~/mydroid (or wherever you put things)
$ make sdk
to build your own shiny version of Android from scratch. This took over an hour on my laptop, so be patient. When it's finished, you should be able to change to the results directory and running the freshly built emulator
$ cd out/host/linux-x86/sdk/android-sdk_eng._linux-x86
$ tools/emulator
You should see an Android emulator window pop up on your screen running your freshly built code.

No comments: