Windows下载android2.2完整源码

来源:互联网 发布:ubuntu hdmi显示桌面 编辑:程序博客网 时间:2024/04/23 22:16

IT程序员开发必备-各类资源下载清单,史上最全IT资源,个人收藏总结!


前两天看到有人给我留言,才发现很久没写过东西了。不过,最近也没做什么东西。下载了一个cygwin,在Windows下载android完整代码。

1、  下载安装cygwin。参考http://yuanzhifei89.iteye.com/blog/1117549

这个项目的名字来源于:GNU、Cygnus、Windows,3者的缩写。Cygwin的目标是:构建一套Windows下的Linux模拟环境。因此,Cygwin是一个庞大的项目,不只包括Linux下的开发环境,也包括工作环境,和各种各样的Linux下的软件。

http://cygwin.com/install.html该页面能够下载到一个网络安装程序setup.exe,然后通过它我们就可以更新和下载最新的工具版本了。

选择下载的地址,

 

获取android源码主要用到的工具:

cURL:cURL是一个利用URL语法在命令行方式下工作的文件传输工具。

http://curl.haxx.se/ 

 

git:android使用的版本控制软件。

http://git-scm.com/download 

windows版git(msysGit),带有gui的http://code.google.com/p/msysgit/downloads/list?can=3

 

repo:建立在git上的一个管理工具,简化git的使用的。它其实就是一个python脚本文件

http://android.git.kernel.org/repo

这三个工具在cygwin安装的时候,需要选择一同安装。

 

 

 

选择三个工具后,下载依赖。

 

只需一路next,安装完成即可。

2、  使用cygwin

查看安装的工具是否安装好。

Git –version查看git版本,curl 查看curl;Python –V查看python版本。如下

 

接下来和在ubuntu上下载整个源码差不多。

 //下载安装repo版本管理工具:

$curl http://android.git.kernel.org/repo> /home/android /bin/repo

$cd bin

$chmod a+x repo

失败的情况

注:图中的repo下载失败了。。。。。

 

$python ./bin/repo init -u git://android.git.kernel.org/platform/manifest.git –b froyo

失败,由于android.git.kernel.org不能访问。

根据http://www.bashell.net/archives/repo-without-android-git-kernel-org.html提供的方法进行访问。

1、使用git-repo项目,地址是http://code.google.com/p/git-repo/

我使用的版本为1.13 ,地址http://git-repo.googlecode.com/files/repo-1.13

为了保持使用的习惯,将repo-1.12改名为repo。

$ mv repo-1.12 repo

由于使用cygwin,我们可以在cygwin对应的目录下直接修改文件名。

 

3、  添加执行权限

$chmod a+x repo

4、  初始化repo

$python ./bin/repo init -u git://android.git.kernel.org/platform/manifest.git –b froyo

错误情况:

l  如果git失败,将git修改为http,下图即git连接失败

$python ./bin/repo init -u http://android.git.kernel.org/platform/manifest.git –b froyo

 

 

 

l  如果repo init时出现https 443 ssl错误,那么需要将repo文件中https更改为http

$ sudo vi /user/bin/repo

将第五行

REPO_URL='https://code.google.com/p/git-repo/'

改为

REPO_URL='http://code.google.com/p/git-repo/'

 

 

 

 

由于android.git.kernel.org被黑,找个几个镜像地址。

 

1、https://github.com/android

 

源码在线查看地址http://www.google.com/codesearch/p?hl=en#cZwlSNS7aEw/

 

1)获取 repo

 

#curl https://github.com/android/tools_repo/blob/master/repo > ~/bin/repo

 

2) 初始化

 

#repo init --repo-url=git://github.com/android/tools_repo.git -u git://github.com/android/platform_manifest.git

 

3)修改

 

将\.repo\manifests的default.xml文件,替换为https://github.com/CyanogenMod/android/blob/ce3ef4fa6fb88b2babe11b34a645a15b9b0025f3/default.xml

 

修改文件中的

 

  <default revision="gingerbread"

 

           remote="github" />

 

将版本gingerbread替换为下载的相应版本。例如2.2则修改为froyo

 

Android 1.0

 

Android 1.5:Cupcake(杯子蛋糕)

 

Android 1.6:Donut(甜甜圈)

 

Android 2.0 / 2.1:éclair(闪电泡芙)

 

Android 2.2:Froyo(冷冻忧格)

 

Android 2.3:Gingerbread(姜饼)

 

Android 3.0:Honeycomb(蜂巢)

 

Android 4.0:Ice Cream Sandwich(冰淇淋三明治) 

 

3) Sync repo

 

 

2、https://www.codeaurora.org/

 

下载repo

 

curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo"> ~/bin/repo

 

初始化

 

repo init -u git://codeaurora.org/platform/manifest.git -b froyo

 

但是如何要下载android源代码的话,需要把repo文件打开,把文件开头的

 

REPO_URL='git://android.git.kernel.org/tools/repo.git'

 

的这个地址换成其他可以下载源代码的地址久可以了,上面下载的repo就是把

 

替换成

 

REPO_URL='git://codeaurora.org/tools_repo.git' 

 

这个地址下载速度太慢了,经常断掉。

 

 

5、  同步下载

Repo sync 

原创粉丝点击