首页 / 操作系统 / Linux / 在Ubuntu上下载Google Android4.4源码
在Windows下安装Cygwin,通过Cygwin也可在Windows里通过本文的下载步骤下载Android源码。以下为在Ubuntu下下载Google Android4.4源码的步骤: 1. 安装curl 与 git sudo apt-get install curl sudo apt-get install git-core 2 安装 Repo a) 建立Repo的安装目录、配置环境变量 $ mkdir ~/bin $ PATH=~/bin:$PATH b) 获取Repo工具 $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 问题:上面是Google制定的repo获取地址,但获取可能失败。 解决办法:网上有网友给出了替代的获取地址,如遇报错可用下面的地址替代: curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo (我是使用这个,可用) 然后改变权限: $ chmod a+x ~/bin/repo 3 建立并进入源码下载目录 $ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY 4 初始化源码Repo下载地址 如是下载当前最新的代码,则: repo init -u https://android.googlesource.com/platform/manifest 如是下载特定Android成熟版本分支的代码,则加上-b 参数,如当前最新发布的android 4.4分支代码: repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.1_r1 命令如顺利执行,期间将要求输入unsername和email,直接输入自己的自定义的用户名和email即可。 5 同步全套源代码 $ repo sync 问题:命令执行过程中可能会报错: fatal: "../platform/abi/cpp.git" does not appear to be a git repository fatal: The remote end hung up unexpectedly error: Cannot fetch platform/abi/cpp 解决办法: 进入WORKING_DIRECTORY,显示隐藏文件,可看到.repo目录并打开manifest.xml里,找到fetch属性,并修改为: fetch= "git://Android.git.linaro.org repo sync命令在执行过程中一般不会一次性成功,中途可能超时或存在其他失败,此时只需再次执行repo sync即可,以前的记录会被缓存的。 参考文档:http://www.linuxidc.com/Linux/2014-08/105310.htmAndroid 4.4.4 发布下载 http://www.linuxidc.com/Linux/2014-06/103467.htm最简单的Ubuntu Touch & Android 双系统安装方式 http://www.linuxidc.com/Linux/2014-01/94881.htm在Nexus上实现Ubuntu和Android 4.4.2 双启动 http://www.linuxidc.com/Linux/2014-05/101849.htmUbuntu 14.04 配置 Android SDK 开发环境 http://www.linuxidc.com/Linux/2014-05/101039.htm64位Ubuntu 11.10下Android开发环境的搭建(JDK+Eclipse+ADT+Android SDK详细) http://www.linuxidc.com/Linux/2013-06/85303.htmUbuntu 14.04 x64配置Android 4.4 kitkat编译环境的方法 http://www.linuxidc.com/Linux/2014-04/101148.htmUbuntu 12.10 x64 安装 Android SDK http://www.linuxidc.com/Linux/2013-03/82005.htm更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2更多Android相关信息见Android 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=11本文永久更新链接地址
收藏该网址