Android is a development source code platform, which means that every one of us can download, modify, and create our own Android platform. We can even help Android community to improve and improve.CodeOf course, these are still a little far away from us. They are still a little far away from me, but you can always look at them. This article uses Git to download the android source code in conjunction with the latest official documentation. If any error occurs, please point it out! The procedure is as follows.
1. Install git and curl:
$ Sudo apt-Get install Git-core curl
Apt-get is a Linux Command used to automatically search, install, upgrade, and uninstall software or operating systems from software Repositories on the Internet. Git is an open source distributed version control software developed by Linux Torvalds to help manage Linux kernel development. It is different from a centralized version control system like CVs, git is responsibleSource codeCloneDown. Curl is a file transmission system that uses the URL syntax to work in the command line mode. It supports many protocols, including FTP, ftps, HTTP, https, and Telent, we need to install it to obtain the repo script file from the network.
2. Create a bin folder in the home directory and add it to path.
$ Mkdir ~ /Bin $ Path = ~ /Bin: $ path
3. InstallRepo
DownloadRepoScriptHomeOfBinFolder
$ Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/Repo
ModifyRepoSo that it can be executed
$ Chmod A + x ~ /Bin/Repo
RepoIsGitVersion library management tool, which can be simplifiedAndroidEnableGit. Here, useRepoAnd officially providedAndroid ProjectAutomatic Batch List downloadAndroidThe entire project removes the need to download a large number of projects manually.
4. initialize the repo client to access the android source code.
Create directoryAndroid/sourceCode to store the downloaded source code
$ Mkdir Android/sourcecode
Obtains the project list and initializes the directory.
$ Repo init-u https://android.googlesource.com/platform/manifest
Enter the name, email address, or something as needed.
When initializingRepoAfter the client is complete, a similarRepo is initialized in home/Android/sourcecode.
Note: The latest platform will be downloaded by default.Version, yes4.0.3To download the source code of the specified version, add"-B"Version Code". For details, refer to the official documentation, and download all the source code of this version.3.2 GBTo download onlyAndroid SDKFor the source code, see the official documentation or other materials.
5To download the source code.
$ Repo sync
Then, when"Syncing work tree: 100% (242/242), doneThe download is complete, and the official website says yes1It took me about an hour and a half.
Note that the memory must be2G, Set1gAfter downloading for more than half an hour, it will be congested to half a channel. I saw only a bit of memory left, so I had to turn it off and change it2GMemory and then try again.
See: http://source.android.com/source/downloading.html
In fact, if you only want to view the source code, you don't need to worry so much. You can download the compressed file of the corresponding Android source code from the Internet, and then you can easily view it in eclipse. Download all the source code here, mainly to save it as a backup during compilation.