‘Cupcake’ is the name of the new Android OS which will shortly hit the consumer market. Future Android based phones – such as Lenovo or Kogan agora – will by default probably have the CupCake milestone of the OS installed. This new version carries with it, bug fixes and a couple of enhancements such as video recorder and on-screen keyboard.
There are times when your application’s future compatibility testing cannot wait for an official milestone release and you require the very latest development image of the Android OS to run under the latest Android emulator. There are of course other Android enthusiasts like myself who will find it very exciting to download and play with the source and I’d recommend it, as it is not difficult. In this article I will detail my experience of following the official android documentation to obtain the latest source from the main Android development branch, in this case the contents of CupCake; compiling it and then finally running the images under the latest emulator.
Development Environment
Manually building the source code is system intensive so you should have a good machine in order to compile the project, enough disk space (around 6GB) and a good connection as you will download around 2GB. Currently, I am running Ubuntu intrepid 8.10 with kernel 2.6.27-11-generic and Sun’s jvm 1.6 on a quad core with 4GB of RAM.
Thus the below assumes you are running similar setup. The official Android installation page lists the procedure for Max OS and Windows.
1. Obtaining the code
I followed the Google documentation wiki page without any problems. I had a previous version of the source code checked out on to my machine which I had to update, thus I had to remove the recovery directory as discussed here and here with the following command: rm -rf recovery bootloader
If you do a fresh init you will not need to remove the 2 directories. As I am on amd64, I also had to install the X11 dev packages and followed the workaround suggested for X11.
Note that I did not need to update the java alternative to ia32-sun-java6-bin and used the sun-java6-jdk instead. Furthermore, I did not need to point ANDROID_JAVA_HOME to my JAVA_HOME variable.
2. Compilation
WIth the source code checked out I now made a compilation with ‘make’. The compilation took some time – around an hour on my quad core – enough time to drink a couple of espressos and poke around the source structure. A successful compilation produced a new directory at the root of the source called ‘out’. This directory contained the newly created build which can then be used to start the emulator.
3. Layering on proprietary libs from the G1 – optional
Specific phone manufacturers commonly bundle their own libraries for specific phones. Usually those libraries are proprietary thus need to be downloaded from the phone itself. For now, this is possible only for the G1 as this wiki page indicates. Note that I used my T-mobile phone, not the dev one.
Running ‘make’ will create a specific build for the phone located under ‘<android_source>/out/target/product/dream’. You can run that build within the emulator which would be specific to the HTC dream. I would not anticipate much difference except that you would not have access to specific proprietary hardware powered devices such as the camera phone.
4. Starting the emulator with the new build
Now with a fresh build, I could start the emulator with the new images.
Issued from the root of source, the following command started the emulator with the dream’s image:
./out/host/linux-x86/bin/emulator -system out/target/product/dream -kernel prebuilt/android-arm/kernel/kernel-qemu -data out/target/product/dream/userdata.img
If you have followed me this far but did not compile the dream target, you can run the default images as follow:
./out/host/linux-x86/bin/emulator -system out/target/product/default -kernel prebuilt/android-arm/kernel/kernel-qemu -data out/target/product/default/userdata.img
Voila! I had the latest emulator running! I accessed it using ‘adb shell’ and installed my test applications using: adb install <app>.apk
Stumbling a little is to be expected with any new undertaking but I found the solution to the majority of your average source compilation problems can be found within the or on the well tended official source code documention. Otherwise Google Groups hosts’ an active android mailing list who will try their best to answer questions.
Next I will look into setting up eclipse and maybe playing around with the code if my caffeine level stays high enough.


hello sir,
i am a novice android developer. but i can’t use sqlite with my application. I am searching for help but couldn’t fine. it. It will be better for me if you send me an example code or anything that will help my developing the application.
Regards.
Foyzul Karim
hello Foyzul,
I am a bit confused to what you are referring to. This tutorial does not really discuss SQLite.
Thanks,
Carl