Download Android platform source code

I'm looking for download Android platform source and found several methods, some methods have failed, now write down the download method to test the success of:

1, Environmental requirements

Need to download in Linux environment. I use is Ubuntu

I installed Ubuntu &ldquo Ubuntu is running times wrong; in low-graphic mode”, the solution is as follows:

Choose fourth: exit to consle login  

Then use the user name, password.

Execute a command

sudo apt-get update

sudo apt-get upgrade

After the resumption of execution

2, Download the GIT program

Git is a version control software. Input in the terminal:

sudo apt-get install git-core gnupg flex bison gperf build-essential \zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \libxml2-utils

3, Set download directory

$ mkdir ~/bin

$ PATH=~/bin:$PATH

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

Create a folder for download, save the contents of the

$ mkdir WORKING_DIRECTORY

$ cd WORKING_DIRECTORY

4, To download the kernel source code

$ repo init -u https://android.googlesource.com/platform/manifest
If you want to download branch version, use the following format command
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1.2

(query Android version information, reference https://android.googlesource.com/platform/manifest/+refs)

Finally, by using the following command checkout source code to our set working directory:

$ repo sync

5, May encounter errors

1)error: RPC failed; result=56, HTTP code = XX MiB | XX KiB/s

Encounter the above problems, the general Git is not installed correctly, please re install the use of the second step

2)

error: Failed connect to android.googlesource.com:443;Connection refused while accessing

fatal: HTTP request failed

error: Cannot fetch platform/tools/motodev

error: Cannot fetch platform/frameworks/base

error: Cannot fetch platform/prebuilts/sdk

error: Exited sync due to fetch errors

Solution: to edit the /etc/hosts file

$ vim /etc/hosts

Add the following content, save (ahead of time saved):

74.125.31.82 www.googlesource.com

74.125.31.82 android.googlesource.com

203.208.46.172 cache.pack.google.com

59.24.3.173cache.pack.google.com

If unable to save the case (generally because hosts is read-only), use the following command editor:

$sudo gedit /etc/hosts

Edit and save hosts file after the re input:

$ repo sync


Posted by Sidney at November 22, 2013 - 5:11 PM