mac下下载android源码aosp

目标

在mac系统下将代码下载到移动硬盘中。


步骤

使用repo init 。。。然后 repo sync 就可以了。


问题记录


1.将移动硬盘初始化为区分大小写的osx文件系统。


2.按照谷歌官方的方法https://source.android.com/setup/downloading

在repo init这一步就失败,报错Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle,即使开着搬瓦工翻墙也不行。网上查阅资料,repo init时使用git-repo代替:https://blog.csdn.net/feiniao8651/article/details/59178128,在下方的评论中找到了git-repo的下载方法。


3.不使用官方的仓库,使用国内的镜像。两个选择:清华大学开源镜像和中科大开源镜像。经过几天的痛苦挣扎,选择使用中科大开源镜像。因为好几天了,.repo文件都130多G了,清华大学的就没下载成功过。中科大开源镜像网页:https://lug.ustc.edu.cn/wiki/mirrors/help/aosp。



4.repo init步骤,下载4.2.2版本repo概览:./git-repo/repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-4.2.2_r1

init步骤总算成功了。


5.在sync步骤中,遇到了问题,UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 12: ordinal not in range(128),是编码的问题。

经过网上搜索,修改.repo/repo/manifest_xml.py文件,在import sys 后添加:

reload(sys)

sys.setdefaultencoding('utf8')


修改为utf8编码格式。


6.使用myrepo.sh脚本,在网络不好的情况下能够重新下载。

使用脚本:sh myrepo.sh


repo参数:

-f表示一个project下载失败后,接着下载下一个project。


https://blog.csdn.net/feiniao8651/article/details/59503672

#!/bin/sh

repo sync -f -j4

while [ $? -ne 0 ]

do repo sync -f -j4

done


7. sync 有两个作用:

1.下载repo仓库里的东西。

2.repo仓库里下载完成后从仓库里获取出源码对应的文件夹树。



8.当sync下载失败再次进行下载时,之前下载的内容不会重新下载。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值