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


更多相关文章

  1. NPM 和webpack 的基础使用
  2. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程
  3. 在/external/tinyalsa/pcm.c 添加android log
  4. android使用pull解析器读写xml文件…
  5. android调用本地录制程序获取录制文件路径的问题
  6. android使用ANT打包,签名,混淆
  7. Android(安卓)WebView 加载网页遇到的问题
  8. Android(安卓)Retrofit下载文件
  9. 无需root,清除清理安卓,android的cache,缓存

随机推荐

  1. android横竖屏切换参数
  2. android 模拟器安装
  3. Android Manifest.xml 分析
  4. TableLayout常用细节
  5. 线性布局的常用属性
  6. RelativeLayout参数意义
  7. [Android UI] Activity Maintheme (Andro
  8. Android RatingBar自定义替换系统图片
  9. Android(安卓)声明自身为应用市场
  10. [1] Android主要源代码组成