Just meet to download a specific version of the Android source code, not found on the Internet, so only to download, read the official Google download help but suffer from wall convulsions, download speed is also very slow, so find a few domestic source download, then follow me to move up, Before you do, you will need a Linux-equipped computer or a virtual machine with Linux on it.
(a). Popular science The difference between git and repo
1. Git:Git是一个开源的分布式版本控制系统,用以有效、高速的处理从很小到非常大的项目版本管理。 2. Repo: Repo是谷歌用Python脚本写的调用git的一个脚本。主要是用来下载、管理Android项目的软件仓库(也就是说Repo是用来管理给Git管理的一个个仓库的)
so you need to install git before you do the operation, and repo
(b). installing Git and Repo
- Installing Git:sudo apt-get Install Git-core
- Installing Curl:sudo apt-get Install Git-core Curl
- Download repo via Curl:
mkdir ~/binPATH=~/bin:$PATHcurl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo## 如果上述 URL 不可访问,可以用下面的:## curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo > ~/bin/repochmod a+x ~/bin/repo
Yes, and then he's going to generate a repo file in the specified directory
(iii). Ready to download
- Create working directory (this name is optional)
"'
mkdir working_directory
CD working_directory
-初始化仓库
Repo Init-u git://mirrors.ustc.edu.cn/aosp/platform/manifest
Where Repo init-u https://aosp.tuna.tsinghua.edu.cn/platform/manifest is the source of the image provided by Tsinghua University
Repo Init-u git://mirrors.ustc.edu.cn/aosp/platform/manifest is the mirror source of China University of Science and Technology
If the prompt cannot connect to gerrit.googlesource.com, you can edit the ~/bin/repo file and replace the Repo_url line with the following:
Repo_url = ' Https://gerrit-googlesource.lug.ustc.edu.cn/git-repo '
- 下载指定android版本(将上面初始化仓库的操作换成)
Repo Init-u git://mirrors.ustc.edu.cn/aosp/platform/manifest-b android-4.0.4_r2.1
"'
Version List
- Start synchronizing the source tree
Repo Sync
Download speed identification diagram
Download complete
Download complete in the working directory you can see:
Sync Help
Yes, the file is relatively large, generally in the 10g+, so in the download process will encounter various conditions!
When you need to pause only need Ctrl + C to pause the synchronization, repo is to support the continuation of the breakpoint, shutdown you can also come to the working directory to perform repo sync to continue syncing!
Of course the synchronization process may get stuck regularly, and we can use a script to help
Vim dowmload.sh (if you have not downloaded vim you can perform sudo apt-get install vim for installation, about vim use self-Baidu)
Write the following ancestral code into dowmload.sh:
#!/bin/bash
echo "======start repo sync======"
Repo Sync
While [$ = = 1]; Do
echo "======sync failed, Re-sync again======"
Sleep 3
Repo Sync
Done
CHOMD a+x download.sh Let it run, then terminal input./download.sh can start downloading, replacing the repo sync in the official document with this step. Rest for 3 milliseconds when not connected to the terminal and then automatically repo sync, so you don't have to wait.
Repo download domestic link Android source code