Download Msysgit, install
Official Download: Http://code.google.com/p/msysgit/downloads/list,
Open git Bash, Run command
CD d:git clone https://android.googlesource.com/platform/manifest.git
Enter a command to switch to the manifest folder
CD Manifest
git tag lists Android each branch version number
git tag
Download the android-2.2 system source code, enter the following command, if you want to download other version number source code, checkout git tag listed version number can be
git checkout android-2. 2_r1
After checkout, the path of each module in the android2.2 system is recorded in the Manifest/default.xml file.
Let's analyze the Default.xml file,
Take Bionic as an example, the Path property represents the relative path to the bionic source code, and if the Android source code is d:/android-source, after the download bionic, it should be stored in the D:/android-source/bionic folder
The Name property is the path to the bionic source code on the library, and the full path is: Http://android.googlesource.com/platform/bionic.git, with the source code download path, running git Clone will be able to download the bionic source code to a local
<project path= "Bionic" name= "Platform/bionic"/>
Android source code in a lot of project, one download is more troublesome, I wrote a Python script, double-click download-src.py Run this script, you can download the full Android source code to local.
PS: Run this script if you have run git checkout, choose the Android source code to download the version number, if your manifest file is not d:/manifest/default.xml, please change the script yourself.
download-src.py Source code:
ImportXml.dom.minidomImportOs fromSubprocessImportPager#downloaded source pathRootDir ="D:/android-source"#git program pathgit ="D:/program Files/git/bin/git.exe"Dom = Xml.dom.minidom.parse ("D:/manifest/default.xml") root = Dom.documentelementprefix = git +"Clone https://android.googlesource.com/"suffix =". Git"if notOs.path.exists (RootDir): Os.mkdir (RootDir) forNodeinchRoot.getelementsbytagname ("Project"): Os.chdir (rootdir) d = Node.getattribute ("Path") Last = D.rfind ("/")ifLast! = -1:d = RootDir +"/"+ D[:last]if notOs.path.exists (d): Os.makedirs (d) os.chdir (d) cmd = prefix + node.getattribute ("name") + suffix call (cmd)