[Nexus 4 Android Development] ktomov:
Well. You should follow the official guides. They cover everything. You should also know a bit of how Linux is working. So the answer to your question should start from the very end of your questions.

First: Why do we use linux? Because it's an Open Source product and android is based on linux platform. Most of the compilers, dependencies for builds, like libraries and other software products are only available for linux and Mac, which is unix based.

Then on the other hand are the different linux distributions, like you said - Ubuntu for instance. Ubuntu, Kubuntu, Mint, Ubuntu Gnome are almost quite the same, but they are also different. Ubuntu is based on Debian. The difference is that Debian is known as "stable server" distribution and the updates are mostly patches for security than adding bleeding edge software versions, while Ubuntu is more user oriented OS, giving the users newest versions of the software they need ASAP. Ubuntu use their own Graphical interface called Unity, Kubuntu use KDE, Mint uses Cinnamon/Mate which are Gnome derivatives keeping the gnome 2.* looks, while there is Gnome 3.14 currently.

There are many others and they all are linux. The whole difference between most of them are the package managers. For instance all debian based distributions use APT, as package manager. The command to install software is sudo apt-get install package-name. It'll download and install package-name.deb and all its dependencies (libraries, other programs that are needed for proper use).

Others like fedora are Red Hat Enterprise Linux based and they use YUM as package manager. The command to install software is sudo yum install package-name. It'll download and install package-name.rpm

There are many kinds of distributions. There are Gentoo/Arch, which gives you even more control. You don't download the rpm/deb file with your package manager, but instead you are downloading the source code for a project in compressed archive .tar.bz/.tar.gz/.etc. You can tell the compiler what functions and libraries to compile with it, so it means that you can compile VLC media player for instance with only support of x262. Smaller package, smaller footprint on the hard drive, less libraries etc. This gives you simply the machine that you need for the things you need. The upper too (*buntu and fedora) gives you binaries (already compiled software, like windows exe) for you to simply install, but they may contain things that you'll never need or use.

So the third choice is best for all of the users, but this distributions are for advanced users. Yes there are many how-to's, but still, it'll be pain in the a$$ for anyone to jump from windows to one of those two.

Second: Why we use Ubuntu - well, the instructions are for Ubuntu. There are many developers, that don't want to know all the linux stuff, just to develop their own roms/kernels. Yes it's not needed. It's easier to use ubuntu, because it's more or less easier for install and daily use and maintenance for newcomers to linux. At least it was couple of years ago. For me - it's unusable, but this is just my viewpoint.

You can build android on any linux distribution, but there is the catch - all the instructions are for debian based (Ubuntu/Mint) distributions, and the package names deffer in other distributions. For instance if you need some-lib64 in ubuntu, in fedora it could be called some-lib64-devel, or even it could be contained in other package - some-devel-packages. I have successfully build AOSP/PSX/Rastakat from their github repositories on Fedora 19/Fedora 20/Sabayon (Gentoo based with binary packages). The problem is that if you follow some guides, and you are not on Ubuntu, you'll have to hunt down all the needed libraries in order to compile the source.

And now I'll be short :)

What is the syncing process. To build, you need the sources.

First you need to setup the build environment and the needed guide is here - https://source.android.com/source/initializing.html

You can skip most of the parts, but you should install all the needed packages and openjdk. After that, you have all that you need to compile the sources.

Next you should sync the AOSP repository to your PC, this is what was [MENTION=1050103]sykopompos[/MENTION], problem. The sources are around 32GB, which means that if you are on 50 MB/s connection like me, it could take more than 2-3 hours, and it still depends, because if there is a lot of traffic (people syncing the sources), you can use less than 5 MB/s from your connection, which means 20 hours or so.

Then you need to add the proprietary drivers. They are closed source and are already compiled, that's why you won't get them while you sync the repositories. That are drivers that are not coming from google, but from the manufacturer of the hardware (qualcomm for ex.) and they are keeping them closed. You can compile your rom without them, but you'll end up probably with bootlooping rom, or rom that won't be able to use the camera/wifi/bluetooth/gps and so on.

After that you should only use couple of commands and your compilation procedure will start.

After that you'll get a pure AOSP rom. If you want to change it, well there will be questions for a whole new thread.

P.S. Sorry bout the long post.