android源码下载方式:
方式一:
1) 创建~/bin
$ mkdir ~/bin
$ PATH=~/bin:$PATH2) 下载repo
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo3) 创建保存Android源码文件
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY4) 下载Android源码(master主干)
$ repo init -u https://android.googlesource.com/platform/manifest下载Android源码(branch分支)
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1更多分支目录:
https://android.googlesource.com/platform/manifest
5) 启动同步下载
$ repo sync
上面是官方提供的下载方式
但最近使用这种方式出现网络连接超时,据说是被hack掉了
使用git方式下载:git clone http://android.git.kernel.org/kernel/common.git,最后,成功了
详见博客:android.git.kernel.org[0:199.6.1.173]: errno=Connection refused
方式二:
把方式一的下载命令中的git修改为http(配置文件需一并修改),则可以顺利下载源码
具体修改步骤如下:
1.编辑~/bin/repo文件: vi ~/bin/repo
修改:REPO_URL='git://android.git.kernel.org/tools/repo.git'
改为:REPO_URL='http://android.git.kernel.org/tools/repo.git'
2.运行新的命令
repo init -uhttp://android.git.kernel.org/platform/manifest.git
3.修改文件~/WORKING_DIRECTORY/.repo/manifests/default.xml: vi ~/WORKING_DIRECTORY/.repo/manifests/default.xml
修改:fetch="git://android.git.kernel.org/"
改为:fetch="http://android.git.kernel.org/"
4.运行同步命令,下载源码到本地
repo sync
成功!!!

git使用推荐:
VersionControl with Repo and Git
本文详细介绍了Android源码的多种下载方式,包括官方推荐的repo工具和使用git命令的方法。同时提供了两种下载方式的对比,以及针对网络连接问题的解决策略。通过实例演示了如何使用git命令进行源码下载,确保开发者能够顺利获取和更新Android源码。
1688

被折叠的 条评论
为什么被折叠?



