Android4.04下载源码图解~解决公网IP不能直接访问问题

之前下的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,还没有解决其相关问题的童鞋,你还在等什么呢,试着操作一下吧,最新体验的总是有你才是.......

  • 4
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值