新版的Eclipse 3.6 上线后我们发现他自己集成了一个工具EGit ,所以我们可以方便的使用他去获取Android的源代码。
步骤如下,我都截图了,这样比较直观。
1. 首先可以调整Git资源库的默认保存路径
Window -> Preferences -> Team -> Git 然后如图更改 Repository folder

2. 打开对应的试图
Window -> Open Perspective -> Other...
选择Git Repository Exploring

3.现在可以开始clone源代码了,如图找到Clone Git 按钮

然后会出现需要你输入 资源对应路径 的窗口,如下

本例中我获取了
git://android.git.kernel.org/platform/packages/apps/Settings.git
这个资源。
在Location里的URI 里面输入以上的资源路径,然后按Next
然后会跳出一个选择分支的窗口,我选择了master,然后Next

之后就跳出了一个对应本地存放的窗口,然后按Finish
等待一段时间,OK,成功下载到我们需要的源代码了!


4. 然后我们新建一个Android project

选择对应的平台,我这边选择了2.3.3。
其实随便选择一个都可以。
选择该工程,右键
Team -> share project
选择Git,然后Next,看到如下的画面,选择Finish

最后可以看到非常熟悉的代码同步的图标。
怎么有那么多的红叉叉?是不是少了什么?

其实google 还是隐藏了很多的类,所以编译报错。
更多的模块你可以在这边找到:
具体的资源路径如该网址抬头所示:
git://android.git.kernel.org/
+ project path.比如project的path是 platform/packages/apps/AlarmClock.git
那么最后我们需要的git路径就是
git://android.git.kernel.org/platform/packages/apps/AlarmClock.git
很简单吧!你也可以试一试!
Leon.yan@Android.Dev