歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 解決下載Android源碼時遇到的 download error

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

日期:2017/2/28 14:46:05   编辑:Linux教程

我下載和編譯環境

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帳號進行認證。

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

源碼官網指導網址: http://source.android.com/source/downloading.html

更多Ubuntu相關信息見Ubuntu 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=2

更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11

Copyright © Linux教程網 All Rights Reserved