1.下载android源代码
源代码网址:http://android.git.kernel.org/
可以根据操作系统使用不同的工具进行源代码下载:
? ? ? ?1)windows
下载安装git客户端工具,网址:http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe
? ? ? ? (1)新建一个文件夹,建议名为mydroid
? ? ? ? (2)在新建文件夹图标上右键,选择“Git Bash”
? ? ? ? (3)根据http://android.git.kernel.org/网址中的提示,选择要下载的工程,使用如下命令:
? ? ? ? ? ? ? ?git clone git://android.git.kernel.org/
?+ project path
? ? ? ? (4)具体可参考http://android.git.kernel.org/网址中的提示,如果要下载全部代码,安装repo
? ? ? ? ??
? ? ? To clone one of these trees, install?git, and run:
?git clone git://android.git.kernel.org/
?+ project path.
?
? ? ? To clone the entire platform, install?repo, and run:
mkdir mydroid
cd mydroid
repo init -u git://android.git.kernel.org/platform/manifest.git
repo sync
2)linux下,使用命令行安装git及repo,选择进行全量同步或部分代码下载
具体可参考:http://android.yaohuiji.com/archives/2652
?
2.设置eclipse中android的源代码位置
? ? ? ? 1)在android.jar上右键,选择Build Path->Configure Build Path,如下图
?
? ? ?2)点击“Source attachment:”,点击“Edit”按钮
?
?
? 3)设置Location path为:mydroid文件夹所在盘符:/mydroid/frameworks/base/core/java,点击“OK”
?
? ? 4)按下Ctrl点击类名即可查看源代码,如下图所示:
?
?
?
?