消除下载Android源码时的“curl: (7)”等错误

gaojs@ubuntu:~$ mkdir ~/bin
gaojs@ubuntu:~$ cd ~/bin
gaojs@ubuntu:~/bin$ curl http://android.git.kernel.org/repo>~/bin/repo
curl: (7) couldn't connect to host
gaojs@ubuntu:~/bin$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
curl: (7) Failed to connect to 2404:6800:4005:c00::5d: Network is unreachable
替换成如下的命令即可:
gaojs@ubuntu:~/bin$ curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo"> ~/bin/repo

详见:http://php.webtutor.pl/en/2011/09/05/kernel-org-hacked-how-to-get-android-repo/


然后即可使用如下的命令,下载Android源码了:
gaojs@ubuntu:~/bin$ chmod 777 repo
gaojs@ubuntu:~/bin$ sudo cp repo /bin/
gaojs@ubuntu:~/bin$ mkdir android
gaojs@ubuntu:~/bin$ cd android
gaojs@ubuntu:~/bin/android$ repo init -u https://android.googlesource.com/platform/manifest
gaojs@ubuntu:~/bin/android$ repo sync
会报以下的错误:
fatal: '../platform/abi/cpp.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
error: Cannot fetch platform/abi/cpp

在.repo目录下的manifest.xml里找到fetch属性,改成:
fetch= "git://Android.git.linaro.org/"

然后,再执行repo sync命令!还会报错:
error: The requested URL returned error: 406 while accessing https://android.googlesource.com/platform/manifest/info/refs
fatal: HTTP request failed

解决方法:
1. 浏览器登录https://android.googlesource.com/new-password,并用gmail帐号登录;
2. 点击网页上的“允许访问”,得到类似:

Login for Git:

Username: git-gaojs.hz.cn
Password: 1/5_cUC7YGeYNn71De8of2_1m1mqzpQs6xogGZfGRoj5o

Staying Authenticated - Linux and Mac OS X:

To stay authenticated by saving the password, append the following line to the ~/.netrc configuration file:
Make sure you have set the permissions on ~/.netrc so that only your user account can read the file. If your home directory is on a network filesystem, consider moving it to a local disk and making ~/.netrc a symbolic link to the local version.

Staying Authenticated - Windows:

To stay authenticated by saving the password, append the following line to the %HOME%\_netrc configuration file:
Ensure %HOME% is configured in the environment to be the same location as %USERPROFILE%. Note that by default, Windows systems will not define the environment variable %HOME%; you must explicitly add it:
Start menu -> Computer -> (right click) -> Properties -> Advanced System Settings -> Environment Variables
Make sure you have set the permissions on %HOME%\_netrc so that only your user account can read the file.

3. 把上面那段信息追加到~/.netrc文件结尾(请检查当前用户的权限, 如果不存在此文件则自己新建一个);
4. 下载地址的URI更改为https://android.googlesource.com/a/platform/manifest(中间加上了“/a”)。
5. repo init -u https://android.googlesource.com/a/platform/manifest
6. repo sync
真够曲折的!

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值