To install Repo:

  1. Make sure you have a bin/ directory in your home directory and that it is included in your path:

    $ mkdir ~/bin
    $ PATH=~/
    bin:$PATH
  2. Download the Repo tool and ensure that it is executable:

    $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    $ chmod a
    +x ~/bin/repo

After installing Repo, set up your client to access the Android source repository:

  1. Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:

    $ mkdir WORKING_DIRECTORY
    $ cd WORKING_DIRECTORY
  2. Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.

    $ repo init -u https://android.googlesource.com/platform/manifest

    To check out a branch other than "master", specify it with -b:

    $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

$ repo syn

实际操作中,获得错误报告:fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle,

这个地址和你看到的可能不同,但肯定是 ~/bin/repo 第5行或第6行REPO_URL 所表示的网址。

stockoverflow上有贴提及是代理环境变量造成的问题,想到前面尝试过设置 HTTP_PROXY,用下面的指令清除,HTTPS_PROXY 存在的话也要清除 HTTPS_PROXY。

unset HTTP_PROXY

unset HTTPS_PROXY

然后repo init成功。。。,

如果遇到报错:fatal: '../platform/abi/cpp.git' does not appear to be a git repository

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

提示输入你的姓名 及 邮件地址,你想要使用Gerrit code-review 工具的话就要用你申请的 Google账户使用的邮件地址,没有的话去申请一个,不用花多少时间。

Your Name [XXXXXX]: XXXXXX

6. repo 信息下载后,用 “repo sync”命令将真正的Android代码同步到当前工作目录显示下载状态类似下面

如果repo 操作中遇到网络连接问题,可以通过修改hosts文件尝试解决。Windows在C:\WINDOWS\system32\drivers\etc目录下,Linux用户打开/etc/hosts文件,在文件的末尾添加下面2句:

74.125.31.82 www.googlesource.com.
74.125.31.82 android.googlesource.com


转载于:https://blog.51cto.com/lieyan0525/1316944

更多相关文章

  1. Android(安卓)SAX解析XML文件
  2. Android编译问题
  3. Android将应用log信息保存文件
  4. smali文件语法参考
  5. android 扫描sdcard下的图片
  6. android文件打开方式
  7. Android(安卓)ListView使用方法
  8. 创建文件并进行读写
  9. 多线程下载测试TestDownload

随机推荐

  1. 阿里1688实时数据工程实践
  2. JavaWeb系统自学,全栈学习路线图,百度网盘
  3. flex容器中的四个属性
  4. 函数的声明和定义
  5. 选择器优先级、模块化样式组件、伪类选择
  6. [go-linq]-Go的.NET LINQ式查询方法
  7. 携程实时智能检测平台实践
  8. 最新整理linux云计算课程大纲笔记
  9. flex项目上的三个属性及移动商城首页的页
  10. 关系图谱在贝壳找房风控体系的应用与实践