Posts Tagged ‘Android build’

I wrote some time ago very favorably about future of Android and Android-related job market. Unfortunately, recent events have forced me to re-consider my opinion. I mean Google’s acquisition of Motorola Mobility.

In short, I think this is a big mistake on Google’s side which is very damaging for Android in a long run and, frankly I’m no longer confident in its future. Here is why.

There were 3 main strengths that made Android a dominating force of mobile OS market:

1. Google was a partner to hardware (phone) vendors

2. Android provided cross-platform application layer. Due to this the same application binaries could run on any Android phone notwithstanding underlying hardware

3. Android is free.

Having all those 3 strengths in place Android inhibited emergence of a potential competitor. Why phone vendors would consider another OS even if it had all 3 strengths given that they already have Android?

Until now Google followed Microsoft model: they were providing OS which was used by many hardware (phone) vendors. Google and hardware vendors were partners. After Motorola acquisition they are competitors. Now hardware vendors could not be so certain about using Android. What if at some point Google creates a new version of Android and releases it through Motorola without providing access to it for other hardware vendors. What may prevent them from playing such trick? Remember, for example, that Google didn’t publish Android 3 source? Naturally, as a result of the acquisition other hardware vendors will start hedging their bets by increasing use of other OS, e.g. Windows Mobile. At least Microsoft has proven that it has no intention competing on hardware.

So, strength #1 is no longer there after Motorola Mobility acquisition.

Without it there will be many vendors willing and capable to offer a mobile OS with those 3 strengths.

For example, Microsoft. It (almost) never competes with hardware vendors as I mentioned. Given its financial resources it can easily make new versions of Windows Mobile free or almost free. And with its C# and CLI experience it is absolutely capable of building a cross-platform application layer.

Another contender could be a combination of Intel/Nokia MeeGo and Java cross-platform application layer from Oracle. And those companies have enough money to make their OS free.

Maybe Google believes that Android will be still viable due to its excellent quality? Sorry, but this is not so obvious.

Some time ago I wrote a post where I described my software architect opinion on Android. Internal quality of Android code and code design is far from perfect.

Also, Android bug backlog is growing and serious issues are not addressed for long time.

Take a look at this bug as an example. Sometimes when you send SMS using Android phone to person A it is somehow sent to person B. Pretty serious, right? You would not like this happening to you, probably, would you?

The issue was first reported in June 2010 (more than a year ago). There is 1800+ comments from people having the problem. And this is how the story ends:

Comment 1817 by ksb…@gmail.com, Jun 19, 2011

Instead of worrying about “bots” or whatever and seeming to minimize this problem, you should worry about how your ligitimate customers feel about this issue!

I just sent a text to one girlfriend that my HTC Evo shows was actually sent to her. BUT, the problem is that my girl in Mexico texted me and asked why I sent her a text in English about going to Las Vegas!! That’s completely MESSED UP guys!

I switched to this from my Iphone cause the Iphone home key wouldn’t work, but this is worse! Fix this or I’ll definitely be going back. Apple never screwed up my personal life!!!

Comment 1818 by bweb…@dslextreme.com, Jun 22, 2011

This problem happened to me at the worst of all possible times with the most sensitive of all txt msgs. Becasue of this, my marriage is now in turmoil. Screw Google! I’m going to trash my new Galaxy S and get a Windows 7 phone. I’m talking to a lawyer about being heavily compensated for damages. Never, ever, ever buy a Google phone…that’s the word that I’m going to spread.

Comment 1819 by chicmagn…@gmail.com, Jun 22, 2011

FIX THIS! I just got a Nexus S and the same thing happened to me… I am SOOOOO lucky I didn’t call the person it went to by accident names… This is an AWFUL bug!

Comment 1820 by jrobbins@google.com, Jun 23, 2011

I’m going to block further comments on this issue because it is suspected of placing excessive load on one part of our server-side software for Google Project Hosting.

Labels: Restrict-View-Commit

Comment 1821 by jrobbins@google.com, Jun 28, 2011

Corrected permissions to just block additional comments because of server load.

Instead of fixing the issue Google folks just decided to block users complaining since their complains overload Android bug tracking system.

[Update Aug 24, 2011] It seems that closing channels for feedback about Android problems becomes Google policy.

Overall, Android OS shows all signs of underfunded technology project. Apparently Google just don’t allocate enough money to hire enough properly qualified developers to deliver code of proper quality and to fix the known bugs. Otherwise I can’t explain the issues I am observing.

And having this Google decided to spend $12B on buying Motorola instead of investing enough in Android OS. Nice move, Mr Page 🙂


By entering hardware production Google Android moves from partnership with phone vendors to competition with them.

In  seems Google adopts Apple business model. It is worth reminding that very few companies were successful in a long run trying to produce both hardware and software. Apple is rather an exception and it takes Steve Jobs genius to pull this through (I have big doubts that Apple will be as successful as it is now without Steve).

Overall, I think this Google move will cause re-structuring of mobile OS market and change the trends we had observed until now. Hardware vendors will start looking for alternatives to Android. There may be several options:

  • Broader adoption of Windows Mobile
  • Forking of Android source so that to create another OS based on Android but evolving independently (something like CentOS guys did with RedHat code)
  • Support for some alternative mobile OS like MeeGo modified to become cross-platform one like Android

In short, mobile market enters a period of uncertainty and if you plan to build you career on Android, watch very attentively what is going on mobile market.

[Update from Sep 20, 2011. Things started evolving exactly as I predicted in this post. Look here for an example]



Read Full Post »

Android OS build options

Somebody asked me recently what AOSP stands for in Android context. AOSP actually stands for Android Open Source Project, that simple. However this suggested it might be a good idea to discuss what various Android OS (not Android application!) build options stand for.

Android OS build options are set by lunch command of Android OS build environment (look here at how to set it up if you haven’t done this yet). I guess lunch means  “build menu” in this case. Or somebody can attribute the choice of the command name to the fact that building Android OS takes so long that one can go for a lunch with friends after starting it 🙂

Anyway, if you type lunch command, it offers you several choices:

vlad@vlad-laptop:~/mydroid$ lunch
You're building on Linux

Lunch menu... pick a combo:
1. full-eng
2. full_x86-eng
3. simulator
4. full_passion-userdebug
5. full_crespo-userdebug

Which would you like? [full-eng]

After you select a particular option, lunch command sets certain Android OS build variables that define what and how will be built.

For convenience I assembled a table below that show what values those variables will be getting with each choice:

full-eng full_x86-eng simulator full_passion-userdebug full_crespo-userdebug
TARGET_PRODUCT full full_x86 sim full_passion full_crespo
TARGET_BUILD_VARIANT eng eng eng userdebug userdebug
TARGET_SIMULATOR false false true false false
TARGET_BUILD_TYPE release release debug release release
TARGET_ARCH arm x86 x86 arm arm
TARGET_ARCH_VARIANT armv5te x86 x86 armv7-a-neon armv7-a-neon
HOST_ARCH x86 x86 x86 x86 x86
HOST_OS linux linux linux linux linux
HOST_BUILD_TYPE release release release release release

There are 4 groups of variables:

  1. Those with names starting from PLATFORM… These describe Android OS as a platform, They are mostly for Android OS self-identification purposes
  2. Those with names starting from TARGET… These define a target device or emulator
  3. Those with names starting from HOST…. These define CPU architecture of a computer on which the build happens and its OS (remember, the build can be done on either Linux or Mac)
  4. BUILD_ID variable. Defines a build ID

You can find more about some of those variables if you look at /build/core/version_defaults.mk file in the directory you have downloaded through repo the Android OS source code.

The most interesting among them are TARGET_ARCH and TARGET_ARCH_VARIANT. They define CPU architecture for which the build happen. TARGET_ARCH has two values: either x86 or ARM. This reflects the fact that there are two CPU architectures for smartphones:

  1. ARM architecture. CPUs with such architecture are most common among smartphones
  2. Intel Atom architecture which is a version of x86 for CPUs with very low power consumption (smartphones, tablets, netbooks etc). Until recent ATOM didn’t get much traction due to its higher power consumption, but several months ago Intel announced its new version Atom Z6 which fits nicely in smartphone power limitations. I guess we’ll see more smartphones with Atom CPUs soon

TARGET_ARCH_VARIANT describes a particular model of CPU. For example, armv7-a-neon stands for Cortex A8 CPU which is used e.g. in Samsung Galaxy S smartphone.

Another interesting variable is TARGET_BUILD_TYPE which defines whether debugging functionality is enabled in the OS you are building. This functionality is typically disabled in Android OS installed on a regular devices since it does not make sense unless you debug the OS which is most smartphone owners don’t do.

Knowing all this, we can understand what those build choices actually mean:

  1. full_eng is a plain vanilla Android OS build for devices with ARM CPU
  2. full-x86_eng is a plain vanilla Android OS build for devices with Intel Atom CPU
  3. simulator is a plain vanilla Android OS build for running on AVD device
  4. full_passion-userdebug is a version of Android OS customized by HTC
  5. full_crespo-userdebug is a version of Android OS customized by Samsung

That’s all.

Read Full Post »

If you want to contribute to Android or to fix a bug (as opposite to just developing your own application to run on Android) you need to create a special development environment. This is quite different from Android application development environment as described here for Windows and here for Ubuntu Linux.

You will never need it if the only you want is to develop your own Android application.

Google published instructions for setting the environment and building Android OS here. Below I describe how I did it.

[Added on March 23, 2012. It is more than a year since I have written the post and androidexperiences kindly pointed out that certain URLs have changed since – please see androidexperiences‘ comment below.]

Preparing your computer

First you need to prepare your computer by installing Git, Repo and Java JDK. See Google instructions here. Interesting, Google folks apparently use Ubuntu and Mac OS on their development computers since there is no instruction for Windows computers. Luckily for me Ubuntu is my OS of choice as well.

Make sure your computer has at least 8GB of free space.

Important notes:

  • If you want to build Android 2.3 or later, you must use 64-bit version of Linux. The build even won’t start on 32-bit Linux. As opposite, earlier versions of Android OS required 32-bit Linux to build. Although some developers reported building Android OS 2.2 and earlier on 64-bit Linux, it didn’t work for everybody. If you already have 64-bit Linux, you may be able to resolve the problem by installing 32-bit Linux as a host system (see instructions here)
  • You have to use Java JDK 1.6 for building Android OS 2.3 or later; you have to use Java JDK 1.5 for earlier versions

[Update from Sep 25, 2011. Please see Paul’s comments below (my thanks to him for sharing!). He managed to build Android older than 2.2 successfully on 32 bit Linux and got working OS as a result. However in my opinion as a rule it’s better to follow vendor’s recommendation, so if you have choice, use better 64 bit Linux.]

I will describe how to build Android OS 2.3.

First you need to install necessary packages. You can do it by following command in your terminal console window:

sudo apt-get install git-all gnupg flex bison gperf /
build-essential zip curl zlib1g-dev gcc-multilib g++-multilib /
libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev /
libx11-dev lib32readline5-dev lib32z-dev

I recommend installing git-all package instead of git-core recommended by Google since git-core is an obsolete package.

Install Java JDK 1.6 and make it default one:

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun

Optionally Google recommends installing Valgrind. This can be done by the command:

sudo apt-get install valgrind

Now you need to add ~/bin directory to your path. Such directory does not exist by default, but if you followed my instructions on installing application development environment on Ubuntu published here, you should have had it.

Initializing a Repo client

Android uses git as a version control system. git description says:

Git is popular version control system designed to handle very largeprojects with speed and efficiency; it is used for many high profileopen source projects, most notably the Linux kernel.

Git falls in the category of distributed source code management tools.Every Git working directory is a full-fledged repository with fullrevision tracking capabilities, not dependent on network access or acentral server.

You have already installed git among other packages.

Google wrote a long shell script named Repo which runs on top of git and automates certain source management tasks. More about using Repo and git can be found here.

Go into ~/bin directory:

cd ~/bin

Download Repo script using curl (it should have been installed earlier with other packages):

curl http://android.git.kernel.org/repo >~/bin/repo

This will download repo script into ~/bin directory. Make it executable:

chmod a+x ~/bin/repo

Create a directory to place your working files into and move into it. I named it mydroid, but you can choose any name you want of course:

mkdir ~/mydroid

Move into it:

cd ~/mydroid

Download the latest version of Repo:

repo init -u git://android.git.kernel.org/platform/manifest.git

It will ask you of your name and email address. If you plan to contribute a code, use Gmail  email address if you have such. However it is not necessarily Gmail account, just a valid email associated with a registered Google account. For more info on this see Google instructions.

Downloading Android OS source code

To download Android source code run following command in mydroid directory, i.e. the directory where you initialized Repo (Repo won’t work outside of it):

repo sync

Be ready to wait for quite a while since the amount of data to be downloaded is quite big (more than 2GB). Later you can use the same command to download periodically the latest updates to the source code.

Verifying Git Tags

You may want to verify whether the downloaded code is a real one and it was not altered by somebody.

For this you need to load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.

gpg --import

Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.

Version: GnuPG v1.4.2.2 (GNU/Linux)


After importing the keys, a fag cab be verified with the command:

git tag -v tagname 

Building the source

First go into a directory where you downloaded the source code:

cd ~/mydroid

The run this command:

source build/envsetup.sh

envsetup.sh contains a number of shell functions. After executing the command they become available as additional shell commands. There are many functions. You can see a list of them by typing help command (of course, it will work only after the previous command):


Run lunch command (which is one of functions within envsetup.sh script):


lunch command offers you a menu of choices. We’ll discuss in other post later what those choices mean. For now just select e.g. the first one (enter 1).

lunch will set up certain environment variables that will define the result of the build. You will see something like that:


Now all is ready for the build.

Android OS is build is based on make utility. This may be somewhat surprising since Android contains a lot of Java code and it seems it would be natural to use something more modern like Maven. But the choice is most likely made since Android OS is actually a Linux “in disguise” and Android the most likely “inherited” it from Linux.

You can run either make or m command within your mydroid directory (or whatever name you gave the directory where you downloaded the code). m is the function defined in envsetup.sh script.

Be patient again. The complete build takes around 2 hours on my laptop with 2 core AMD CPU and plenty of RAM.

If the build is successful. The build log will end up with something like that:

target Non-prelinked: sensors.mahimahi (out/target/product/generic/symbols/system/lib/hw/sensors.mahimahi.so)
target Strip: sensors.mahimahi (out/target/product/generic/obj/lib/sensors.mahimahi.so)
Generated: (out/target/product/generic/android-info.txt)
Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
Install system fs image: out/target/product/generic/system.img
Target ram disk: out/target/product/generic/ramdisk.img
Target userdata fs image: out/target/product/generic/userdata.img
Installed file list: out/target/product/generic/installed-files.txt

Congratulations! You have built android.

However if you see something like this

collect2: ld returned 1 exit
statusmake: *** [out/host/linux-x86/obj/EXECUTABLES/emulator_intermediates/emulator] Error 1

the build failed. We have to look at the next section:


Android build is very complex one and therefore relatively brittle. If your build fails for reasons you can’t understand, run either

make -B


m -B

This forces make to re-build all targets, i.e. to do a “clean” build.

If your build fails because of a missing run-java-tool, Google recommends setting the ANDROID_JAVA_HOME environment variable before running the build.


Read Full Post »