Android4.04下載源碼圖解~解決公網IP不能直接存取問題

來源:互聯網
上載者:User

之前下的ANDROID4.0.1很順利下來下來,有很多人問,後來才知道有很多人問關於報以下錯誤的

上面是連結GOOGLE源碼伺服器逾時,也就是說不能訪問到GOOGLE源碼伺服器,這個問題,沒想到在我重新裝的機子上不小心發現了,既然發現來就出來解決下吧,剛開始,一開始,我們肯定是先看官方文檔,看看情況:

Using authentication

By default, access to the Android source code is anonymous. To protect the servers against excessive usage, each IP address is associated with a quota.

When sharing an IP address with other users (e.g. when accessing the source repositories from beyond a NAT firewall), the quotas can trigger even for regular usage patterns (e.g. if many users sync new clients from the same IP address within a short period).

In that case, it is possible to use authenticated access, which then uses a separate quota for each user, regardless of the IP address.

The first step is to create a password from the password generator and to save it in ~/.netrc according
to the instructions on that page.

The second step is to force authenticated access, by using the following manifest URI: https://android.googlesource.com/a/platform/manifest. Notice how the /a/ directory
prefix triggers mandatory authentication. You can convert an existing client to use mandatory authentication with the following command:

$ repo init -u https://android.googlesource.com/a/platform/manifest
Troubleshooting network issues

When downloading from behind a proxy (which is common in some corporate environments), it might be necessary to explicitly specify the proxy that is then used by repo:

$ export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>$ export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>

More rarely, Linux clients experience connectivity issues, getting stuck in the middle of downloads (typically during "Receiving objects"). It has been reported that tweaking the settings of the TCP/IP stack and using non-parallel commands can improve the situation.
You need root access to modify the TCP setting:

$ sudo sysctl -w net.ipv4.tcp_window_scaling=0$ repo sync -j1

以上是我在官方摘錄下來的,主題是:使用認證,並且上面提到預設訪問ANDROID源碼是通過匿名訪問的,然而為來保護過度使用伺服器,且配置來每個IP地址的訪問方式,在上面的英文寫得很清楚,自己去看看吧,太晚來,我也不再翻譯來,很簡單的,那我就來幾張簡單的操作吧:

在這裡需要提醒下,先要通過訪問:https://android.googlesource.com/new-password來獲得相關認證的使用者名稱與密碼:

點擊允許,進入頁面,要求你輸入一個郵箱的使用者名稱與密碼,然後得出其以下頁面顯示:


細心點的人就會看到這麼一句話:he first step is to create a password from the
password generator and to save it in ~/.netrc according
to the instructions on that page.

這是需要你去你本系統的~/下建立一個.netrc檔案,預設系統下是沒有的,然後把其獲得的兩行:

machine android.googlesource.com login git-jiangshide8.gmail.com password 1/6PLFhB-9Rbtl7-TAzm9Bzj_zKuxGNq5ALCzFfSuhHgs
machine android-review.googlesource.com login git-jiangshide8.gmail.com password 1/6PLFhB-9Rbtl7-TAzm9Bzj_zKuxGNq5ALCzFfSuhHgs

拷貝進去,然後儲存,然後重新執行:

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

記住與之前的多來個a路徑哦,再接著,執行:

sudo sysctl -w net.ipv4.tcp_window_scaling=0$ repo sync -j1
就OK了,為來讓各位放心去操作,我把成功操作的圖都截取下來:

看看,速度還是挺快的,1016KIB/S了,OK,還沒有解決其相關問題的童鞋,你還在等什麼呢,試著操作一下吧,最新體驗的總是有你才是.......

聯繫我們

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