Download Android source code
When downloading the android source code for the first time, you will inevitably encounter some small issues, such as so.
If the English is good, you can directly look at this: http://source.android.com/source/downloading.html
1. Create a folder for your source code:
$ mkdir ~/bin$ PATH=~/bin:$PATH
Ii. Download tool repo
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo$ chmod a+x ~/bin/repo
Possible problems: download failure or download failure
Solution: Change
$ Curl http://git-repo.googlecode.com/files/repo-1.12> ~ /Bin/repo
Or:
$ Curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo">./repo // get repo
3. Find a place with a large space and put the source code to be downloaded,
$ mkdir YOU——WORK_NAME$ cd YOUR——WORK_NAME
IV,
Repo init initialization code repository
$./Repo init-u https://android.googlesource.com/platform/manifest
5. Download source code
$ repo sync
Possible problems: connection failure or download interruption
Solution:
Locate the fetch attribute in manifest. xml under the. repo directory
Change
Fetch = "git: // Android.git.linaro.org/" or fetch = "https://android.googlesource.com/" (the latter is said to download fast, unverified)
For interruptions, you can write a brother script as follows:
Create script download. sh
#! /Bin/bash
Echo "========= start repo sync ===================="
./Repo sync
While [$? = 1]; do
Echo "===== sync failed, re-sync again ====="
Sleep 3
./Repo sync
Done
Remember that chomd a + x download. sh allows it to run.
Tip: the download takes a long time. You can set up a PC Download at night.