Download Android 4.0.1 source code in Ubuntu 13.04

Source: Internet
Author: User
Tags valgrind git commands

During the download of Android4.0.1 source code in Ubuntu 13.04, I initially referred

Download and install the SDK, but you will find that the SDK is not too busy. The detailed process is recorded here:

1. on the premise that the Android development environment has been set up, that is, the jdk has been installed. Enter java-version to check whether it is successful. To build an android development environment, you can see [] and 【].

How to compile the Android 4.0.1 source code and goldfish kernel in 32-bit Ubuntu 11.10

2. Install the git tool first, while the repo is based on git. To install the required software, run the following command:

Sudo apt-get install git-core flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl valgrind

The final valgrind is used for compilation, saving time at one time. To download the source code, you only need to install curl and git-core. Curl is a File Transfer tool 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. Then curl cannot be used. Repo is based on git and git is a distributed version control software. Because the android source code is composed of many parts, if you use git, You need to clone it multiple times. Therefore, google provides a repo, which is essentially a script written by several git commands. This is the relationship between curl git repo. For repo and git usage, refer to here:

(1 ),

(2 ),

3. Use curl to download the repo script

Log on to a common user, not the root user. Then ~ Indicates the directory of/home/xxx/, in ~ Create a new bin folder to store the downloaded repo script. Refer to the android official guidance document http://source.android.com/source/downloading.html, and then ~ Add the/bin directory to PATH. The method is sudo gedit/etc/profile, and then add PATH = $ PATH :~ After/bin is saved and disabled, enter source/etc/profile on the terminal to make the settings take effect. In fact, the absolute path can also be used for writing to death./home/xxx/bin should note that all of this is under normal users. If you log on as a root user ,~ Indicates the/root folder. Therefore, the android source code downloaded this time must be a common user. Do not switch between them. Because ~ The representation is different for common users and root users. This problem does not occur if the absolute path is used.

Then enter the terminal:

Curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo> ~ /Bin/repo Use this command to download the repo script to the bin folder just created.

Lao Luo's blog command is: wget https://dl-ssl.google.com/dl/googlesource/git-repo/repo is wget, should be OK. I used the above curl command. Then chmod a + x ~ /Bin/repo to add executable permissions for it.

4. Create a folder, which is the workspace of the repo. Download the source code here. The directory I created is/home/administrator/document/androidSource. cd. Make sure that the directory is accessible to users.

Then, use the repo init command to initialize the repo. If you enter:

Repo init-u https://android.googlesource.com/platform/manifestis used to download the latest androidsource code. Generally, you can use the-B parameter to specify the downloaded android version. Enter:

Repo init-u https://android.googlesource.com/platform/manifest-B android-4.0.1_r1 is to let the repo download 4.0.1 source code, you can also use-B Jelly Bean to specify the android version, the specific can refer to: http://source.android.com/source/initializing.html

Compare it with http://source.android.com/source/build-numbers.html.

If you enter the above repo init ................. xxx, go to the next step to download the source code, but the following error will occur during the download:

Error: The requested URL returneerror: 406 while accessing https://android.googlesource.com/platform/manifest/info/refs
Fatal: HTTP request failed
Error: The requested URL returneerror: 406 while accessing https://android.googlesource.com/platform/manifest/info/refs
Fatal: HTTP request failed
Fetching projects: 9% (20/221) error: The requested URL returned error: 406 while accessing https://android.googlesource.com/platform/external/bison/info/refs
Fatal: HTTP request failed
Fetching projects: 10% (23/221) error: Failed to connect to 2404: 6800: 4008: c01: 52: Network is unreachable while accessing https://android.googlesource.com/platform/external/apache-xml/info/refs
Fatal: HTTP request failed
Error: Failed to connect to 2404: 6800: 4008: c01: 52: Network is unreachable while accessing https://android.googlesource.com/platform/external/astl/info/refs
Fatal: HTTP request failed
Error: The requested URL returneerror: 406 while accessing https://android.googlesource.com/platform/external/bluetooth/glib/info/refs
Fatal: HTTP request failed
Error: The requested URL returneerror: 406 while accessing https://android.googlesource.com/platform/external/astl/info/refs
Fatal: HTTP request failed
Fetching projects: 11% (25/221) error: The requested URL returned error: 406 while accessing https://android.googlesource.com/platform/external/apache-xml/info/refs

The core of the error is error android.googlesource.com/platform/manifest/info/refs. this is set by google to prevent too many anonymous access connections.

Solution: log on to the terminal in the browser (I only found the OK button ):

Login for Git:
Username: git-yanzi1225627.gmail.com
Password: 1/IwTl_VomaQWIk0I4gRjdDL5SybS8MGDv15Cb0bLonMg
Staying Authenticated:
To stay authenticated by saving the password, append the following line to ~ /. Netrc configuration file:
Machine android.googlesource.com login git-yanzi1225627.gmail.com password 1/machine android-review.googlesource.com login git-yanzi1225627.gmail.com password 1/IwTl_VomaQWIk0I4gRjdDL5SybS8MGDv15Cb0bLonMg

Make sure you have set the permissions on ~ /. Netrc so that only your user account can read the file. If your home directory is on a network filesystem, consider moving it to a local disk and making ~ /. Netrc a symbolic link to the local version.

Create a new. netrc file, gedit ~ /. Netrc. If yes, you do not need to create a new one. There is a "." In front of linux, indicating that this file is a hidden file. Enter the two lines starting with "machine" in the text box and save them.

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.