Android source code download

2019-03-27 08:50发布

问题:

I have a few questions regarding android source code download, repo / git.

This page says that The source download is approximately 6GB in size, but when I downloaded my directory size is 11GB. What did I do wrong?

I downloaded the source code using
repo init -u https://android.googlesource.com/platform/manifest
Does it download source code for all versions of Android? If so, I don't see separate directories for different versions. How to check/list all available versions?

And what would have changed if I had used
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 instead?

Also repo branches outputs (no branches)

回答1:

I can answer you for several your questions:

The source download is approximately 6GB in size, but when I downloaded my directory size is 11GB. What did I do wrong?

You did nothing wrong. Actually this source is not updated with new information. Now sources about 11Gb and if you build them they will take about 16 Gb.

I downloaded the source code using repo init -u https://android.googlesource.com/platform/manifest Does it download source code for all versions of Android? If so, I don't see separate directories for different versions.

Android sources are under git version control system. They are separated in the number of projects. So to deal with all this project the Android team created a special tool called repo. You can read how to use it here.

And what would have changed if I had used repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 instead?

In the first case you'll sync with the more recent version of Android. This version is not always stable. While in the latter case you switch to the tag that is assigned to a stable version. For instance, I guess now is the more recent version is 4.0.4... So in the first case you'll download this more recent version (that are under development and actually developers post their code to this version), while in the latter case you will download 4.0.1 version.