Google official download source used by the system Ubuntu system, but now we need to download the Android source code files in the Windows system.
The address of the website is: https://android.googlesource.com/
It includes all the parts of the Android system source code, we just need to download platform on the line
Click to enter to see
Address is: https://android.googlesource.com/platform/manifest
1. Preparatory work
Android source control uses git, so installing git is essential, Windows system is using Mysysgit current version is Git-1.9.5-preview20150319.exe, self-search download. The source code download is done using a Python script, so you also need to install a Python environment.
2. Download the XML description file
Enter a folder to store the XML description file and open git bash to execute the following command
git clone https://android.googlesource.com/platform/manifest
No unexpected words will be downloaded soon, if there is an interruption, please use the scientific Internet method to re-download, here is recommended a stew hosts:http://levi.yii.so/archives/3553
When the download is complete, execute the following command:
git tag
Select the version you want to download, and then execute the following command to check out the appropriate version information, which has been android-5.1.1_r8 for example:
git checkout ANDROID-5.1.1_R8
The path to the Android source code is defined in the Default.xml file.
3. Write a Python script to download the source code
The contents of the file are as follows, followed by a specific explanation:
Import xml.dom.minidomimport osfrom subprocess import call#downloaded Source Pathrootdir = "d:/android/source/ ANDROID-5.1.1_R8 "#git Program pathgit =" C:/Program Files (x86)/git/bin/git.exe "dom = Xml.dom.minidom.parse (" d:/ Android/source/manifest/default.xml ") root = Dom.documentelementprefix = git +" clone https://android.googlesource.com /"suffix =". Git "If not os.path.exists (RootDir): os.mkdir (RootDir) for node in Root.getelementsbytagname (" project " ): os.chdir (rootdir) d = node.getattribute ("path") Last = D.rfind ("/") if last! =-1: d = RootDir + " /"+ D[:last] if not os.path.exists (d): os.makedirs (d) Os.chdir (d) cmd = prefix + node.getattribute (" Name ") + suffix call (cmd)
Line 6th: RootDir represents the source of the storage path
Line 9th: git represents the installation path for Git
Line 11th: The path of the Default.xml file just downloaded for checkout
If the path has a different place, modify it according to your own circumstances
The final step is to execute this Python script for download, and wait ...
Python download-src.py
Windows platform download Android source code (collation)