解決下載Android源碼時遇到的 download error

來源:互聯網
上載者:User
參考文檔:解決下載Android源碼時遇到的 download error

 

我下載和編譯環境

ubuntu 12.04 64位 lenovo thinkpad i3 2G

最近要做 android 的瀏覽器外掛程式 要用到 android 的源碼 參與編譯(不是指 framework 層源碼)

按照 google 的官網設定會出現在下載的時候產生錯誤 從而不能下載

 

之前Android的代碼是在Linux kernel(android.git.kernel.org)管理,被Kernel踢出來之後,Android源碼現在直接由Google(android.googlesource.com)管理。
用repo/git下載源碼時,執行

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

 

會報錯誤 異常為

1 DownloadError: android.googlesource.com: <urlopen error [Errno 110] Connection timed out> 

 

解決方案

1. 瀏覽器登入https://android.googlesource.com/new-password,並用gmail帳號登入;

2. 點擊網頁上的“允許訪問”,得到類似

1 machine android.googlesource.com login git-<userName>.gmail.com password <password>   2 machine android-review.googlesource.com login git-<userName>.gmail.com password <password> 

3. 把上面那段資訊追加到~/.netrc檔案結尾(請檢查目前使用者的許可權, 如果不存在此檔案則自己建立一個);

4. 的URI更改為https://android.googlesource.com/a/platform/manifest(中間加上了“/a”)。

5. repo init -u https://android.googlesource.com/a/platform/manifest -b android-2.3.3_r1

6. repo sync 

即可拉下Android源碼。

官方的說法是:因為訪問基本是匿名的,為了防止串連過多(指內網/虛擬機器),對同一IP地址的串連數做了一定的限制。看來是用gmail帳號進行認證。

這樣的話,在公司網路內或者用虛擬機器下載的話,會經常遇到這問題。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.