您的位置:首页 > 移动开发 > Android开发

android 源码下载及问题

2013-10-29 22:12 453 查看
To install Repo:
Make sure you have a bin/ directory in your home directory and that it is included in your path:
$ mkdir ~/bin
$ PATH=~/bin:$PATH

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:
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

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[/code]   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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: