Download the latest android source code (version 4.4.2 _ r1 or later)

Source: Internet
Author: User

 

The red font indicates the option that is being selected.

 

Install curl

$ Sudo apt-get install curl

 

Install the git Tool(Install the latest version as follows)

Add ppa

$ Sudo apt-add-repository ppa: git-core/ppa

$ Sudo apt-get update

$ Sudo apt-get install git

Git version is the latest

$ Git -- version

Git version 1.8.5.2

Error: sudo apt-add-repository ppa: git-core/ppa error: gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com/gpgkeys: HTTP fetch error 7: couldn't connect to host

Cause: keyserver.ubuntu.com uses a non-standard port 11371, Which is blocked by the company's firewall and the standard port 80 is allowed.

Therefore, you can use port 80 to add software sources as follows:

$ Sudo apt-key adv -- recv-keys -- keyserver hkp: // keyserver.ubuntu.com: 80 E1DF1F24

The green part is the Key you want to request.

 

Download repo Tool

Google tells us this:

$ Curl http://commondatastorage.googleapis.com/git-repo-downloads/repo> ~ /Bin/repo

$ Chmod a + x ~ /Bin/repo

But it seems that it cannot be accessed.

Solution: http://code.google.com/p/git-repo/downloads/detail? Name = repo-1.12 this link provides download repo!

You can also run the following command:

$ Curl http://git-repo.googlecode.com/files/repo-1.12> ~ /Bin/repo

I added a 1.20 s download after http. Actually, no other version of the error is returned.

$ Curl https://commondatastorage.googleapis.com/git-repo-downloads/repo>./repo

The specific repo version can go to view information on the http://code.google.com/p/git-repo/downloads page, download that version is OK.

Modify execution permission

$ Chmod a + x repo

 

Repo init create warehouse

Initialize the android source code and download the latest code.

$./Repo init-u https://android.googlesource.com/platform/manifest

Or get a branch like this like a android-4.4.2_r1

$./Repo init-u https://android.googlesource.com/platform/manifest-B android-4.4.2_r1

If you need to download another branch, change the android-4.4.2_r1 to another branch name. Branch name please view branch in https://android.googlesource.com/platform/manifest/+refs

 

Execute repo sync for synchronization

$./Repo sync

 

When you use repo sync to synchronously download code, the code may be frequently disconnected due to network reasons. You can use the following script to create a script file and automatically download it after it is interrupted.

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

Chomd a + x download. sh allows it to run, and then enter./download. sh on the terminal to start downloading. Use this step to replace repo sync in the official document. When the terminal cannot be connected, the system takes 3 ms of rest and then automatically repo sync.

 


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.