windows下android源代码的下载

来源:互联网 发布:node.js java 编辑:程序博客网 时间:2024/06/05 17:12

Linux、Mac环境下的android系统完整源代码下载可参考官方步骤:http://source.android.com/source/downloading.html
在windows环境下要下载编译android源代码,首先模拟一个Linux环境,下载安装Cygwin,官方下载地址:http://cygwin.com/install.html,有32位与64位的,以下图解说明Cygwin的安装步骤(32位为例):

1.运行setup-x86.exe出现安装向导


2.点击【下一步】


3.选中第一项“Install from Internet”,从网络下载安装,然后点击【下一步】


4.选择安装目录,点击【下一步】


5.选择下载文件的存储目录(由于笔者之前已下载过,所以这里目录为之前下载文件所在的目录),点击【下一步】


6.直接点击【下一步】

7.选择一个下载地址,这里选择第一个地址(经测试下载速度还可以),点击【下一步】


8.等待进度完成,点击【下一步】


9.选择安装包,根据自己的需求选择,仅下载android源码所需要的有:Devel -> git*(git相关的);Net -> curl;Libs -> libreadline7,libiconv2;Python -> python等,如果需要编译,则要gcc,make等更多其他的工具包。为了避免以后麻烦,安装Devel下的所有,选择的越多,所需下载时间越长。选择完毕后点击【下一步】,等待下载安装结束。

10.安装完成后,启动Cygwin,然后创建一个文件夹用来存放android源码,文件夹路径名称不能有空格,我这里在D:\AndroidSrc下

11.如果要下载android某个版本的完整系统,可参考http://source.android.com/source/downloading.html,这里介绍单个模块的下载,打开https://android.googlesource.com/可查看android的各个模块部分,点击进入对应模块,网页顶部会显示git下载地址


12.接下来就开始准备下载,在cygwin命令窗口中切换到要下载的目录d:\AndroidSrc


13.下载manifest,输入git clone https://android.googlesource.com/platform/manifest.git,下载结束后,cd到manifest目录,通过git tag命令查看android的各个分支版本


14.下载android-2.3.3的系统源码,输入git checkout android-2.3.3_r1.1_,如果要下载其他版本源码,checkout git tag列出的版本号即可


15.checkout之后,manifest/default.xml文件中记录的就是android2.3.3系统各个模块的路径,可打开查看


path表示模块的相对路径,name属性是源代码在库上的路径,例如要下载framework/base,完整路径就是http://android.googlesource.com/platform/framework/base.git

16.新建一个android-2.3.3的目录来下载framework/base的代码



17.下载结束后就可以查看framework的代码了,如果要下载其他模块,下载方法一样,仅下载的路径不同而已


附加命令代码:

a.单个模块下载

$ cd /cygdrive/d/AndroidSrc$ git clone https://android.googlesource.com/platform/manifest.git$ cd manifest$ git checkout android-2.3.3_r1.1_$ cd ../android-2.3.3$ git clone https://android.googlesource.com/platform/framework/base.git


b.下载完整系统(参考http://source.android.com/source/downloading.html)

$ cd /cygdrive/d/AndroidSrc$ mkdir bin$ PATH=/cygdrive/d/AndroidSrc/bin:$PATH$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /cygdrive/d/AndroidSrc/bin/repo$ chmod a+x /cygdrive/d/AndroidSrc/bin/repo$ mkdir android-2.3.3$ cd android-2.3.3$ repo init -u https://android.googlesource.com/platform/manifest$ repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.3_r1.1_$ repo sync


说明:repo是建立在git上的仓库管理工具,具体可参考http://source.android.com/source/developing.html


原创粉丝点击