Ubuntu 10.04 下載android4.2 源碼

來源:互聯網
上載者:User

新版本的android源碼要求git版本不得低於1.7.2,而ubuntu預設的不夠,或者用別的方式無法正常升級時,可採用下面這個方式來升級個git

sudo add-apt-repository ppa:git-core/ppa

sudo apt-get update

sudo apt-get install git


1、安裝curl

 在終端中執行 sudo apt-get install curl

2、建立一個~/bin目錄,並添加到環境變數中

$ mkdir ~/bin

$ PATH=~/bin:$PATH

3、下載repo指令碼並修改許可權為可執行

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

$ chmod a+x~/bin/repo

4、建立一個儲存android源碼的目錄,修改為最大許可權(這個是我自己增加的一個操作,怕以後操作許可權不足等麻煩),並進入到該目錄下

$ mkdir /opt/android_source

$ sudo chmod –R 777 /opt/android_source

$ cd  /opt/android_source

5、初始化repo,並選擇要下載的分支(版本)

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

$ repo init -u https://android.googlesource.com/platform/manifest-b
android-4.2_r1

備忘:在這過程中需要輸入你的姓名、郵箱等資訊。感覺只要輸入就可以了,我輸入了一個隨意名稱,我自己的126郵箱

6、開始下載源碼

$ repo sync


代碼下載過程中,經常提示以下錯誤:

error: Failed connect to android.googlesource.com:443;Connection refused while accessinghttps://android.googlesource.com/a/platform/frameworks/base/info/refs

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

解決方案:編輯/etc/hosts檔案

$ vim /etc/hosts

增加下面內容,儲存(提前儲存好):

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

然後重新輸入

$ repo sync

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.