当前位置:编程学习 > wap >>

repo sync获取安卓4.0的代码老是出错,下不下来

比如运行命令如下,今天使用了一个脚本跑了一天,也没有下下来,这个是不是服务器那边有问题啊,还是我的机器有问题,

caoguang@caoguang-Aspire-4738G:~/WORKING_DIRECTORY$ ./reposync.bash
“======start repo sync======”
Fetching projects:   2% (5/221)  Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/caoguang/WORKING_DIRECTORY/.repo/repo/subcmds/sync.py", line 200, in _FetchHelper
    clone_bundle=not opt.no_clone_bundle)
  File "/home/caoguang/WORKING_DIRECTORY/.repo/repo/project.py", line 978, in Sync_NetworkHalf
    and self._ApplyCloneBundle(initial=is_new, quiet=quiet):
  File "/home/caoguang/WORKING_DIRECTORY/.repo/repo/project.py", line 1519, in _ApplyCloneBundle
    exist_dst = self._FetchBundle(bundle_url, bundle_tmp, bundle_dst, quiet)
  File "/home/caoguang/WORKING_DIRECTORY/.repo/repo/project.py", line 1583, in _FetchBundle
    raise DownloadError('%s: %s ' % (req.get_host(), str(e)))
DownloadError: android.googlesource.com: <urlopen error [Errno 110] Connection timed out> 

脚本内容为
#!/bin/bash
echo “======start repo sync======”
repo sync
while [ $? = 1 ]; do
echo “======sync failed, re-sync again======”
sleep 3
repo sync
done

--------------------编程问答-------------------- 要不试试
while [ 1 ] ; do
    repo sync
    [ -n "$?" ] || break
done --------------------编程问答-------------------- 这个跟脚本没有关系,最近一直都是这样字,下不下来,除了这种上网下的方法,还有其他的地址可以下到源代码吗,比如从网盘啥的 --------------------编程问答-------------------- 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:

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>  

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

的信息。

3. 把上面那段信息(<userName>和<password>用自己得到的真实信息)追加到~/.netrc文件结尾;

4. 下载地址的URI更改为https://android.googlesource.com/a/platform/manifest(中间加上了“/a”)。
然后按照官网描述的正常步骤操作,即可拉下Android源码。 --------------------编程问答-------------------- 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
--------------------编程问答-------------------- 解决下载Android源码时遇到的问题
http://blog.csdn.net/thl789/article/details/7524232 --------------------编程问答-------------------- 怎么解决的能不能解释一下啊?谢谢哦qq:907325979@qq.com --------------------编程问答-------------------- 四楼楼主, 把上面那段信息(<userName>和<password>用自己得到的真实信息)追加到~/.netrc文件结尾 这个是在那个目录下? --------------------编程问答-------------------- repo init做了么? --------------------编程问答-------------------- 把.repo目录删除,
去soure.android.com上重新下载更新repo脚本,按照上边的说明一步步操作吧
--------------------编程问答-------------------- 没办法的 google的source地址又被墙了
你试试改用http下载 别用git了 
另外修改一下 bin/repo下面的脚本试试
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,