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 > ~/bin/repo

$ chmod a+x ~/bin/repo

Create a folder for download, save the contents of the



4, To download the kernel source code

$ repo init -u
If you want to download branch version, use the following format command
$ repo init -u -b android-4.2.2_r1.2

(query Android version information, reference

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


error: Failed connect to;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):

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