`

git 获取android source

阅读更多


在做android开发的时,在遇到某一问题,想看android 源代码, 模仿高手的写法, 寻求点思路。 但是之前一直困于没有获取到source code, 因此一直没有机会, 今天花了几个小时的时间,学习 git , 怎么获取android源代码。


android source 托管在两个地方:

1. https://github.com/android/

2. https://android.googlesource.com/?format=HTML


首先要说的是,获取android source code的方法简单。


1. 安装git


软件安装包:

windows : http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.11-preview20120710.exe

  or http://code.google.com/p/msysgit/


具体的安装这里不介绍了。 基本上是next 就可以。


2. 下载android 源代码

  2.1 用git 下载 platform/manifest

<1> 首先在windows 开始菜单中打开 git Bash

<2> 创建存放目录

例如:存放到E/android_source中

cd /e/android_source中; 没有android_source目录, 首先创建目录。

<3> 进入目录后,输入

git clone http://android.googlesource.com/platform/manifest.git

结果:新增manifest文件。 里面有5个文件:

.git 目录;

base-for-3.0-gpl.xml;

base-for-3.1-gpl.xml;

base-for-3.2-gpl.xml;

default.xml;

2.2 下载一个应用source code 示例:

下载launcher2:

<1> 打开manifest/default.xml 文件 

内容格式:<project path="packages/apps/Launcher2" name="platform/packages/apps/Launcher2" />

<2>在git bash中 进入目录:E/android_source 下 , 创建一个文件launcher2 

<3> 进入launcher2 : cd launcher2

<4> 输入 git clone http://android.googlesource.com/platform/packages/apps/Launcher2

耐心等待, 下载完成后, 在launcher2中会有source code。

下载其他的同样的方式。

1
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics