Git是一个分布式版本控制/软件配置管理软件,原来是linux内核开发者林纳斯·托瓦兹(Linus Torvalds)为了更好地管理linux内核开发而创立的;由于Android操作系统的核心属于Linux核心的一个分支,所以它也由Git管理。要想理深入学习Android,有必要好好查看它的源代码,由于大多数人都是用Window系统,对于Linux的操作不熟悉,现在不用去安装什么虚拟机了,可以直接在Window下安装Git工具下载Android的源码
首先要安装Git
下载地址:http://download.csdn.net/detail/deng0zhaotai/6759635
可以到code.google下载最新的:http://code.google.com/p/msysgit/downloads/list
http://msysgit.github.io/
安装好Git后,在你需要存放源代码的目录下右键会弹出下面一个菜单
选择:Git Bash后出现以下命令行
在命令中输入:git clone http://android.googlesource.com/platform/frameworks/base.git
按回车会进入下载
1.2G这速度等很久。
到这里Android的代码就下载到了。
进入base目录
输入 ls -l 列出当前所有文件
使用git tag命令查看Android所有的发行版本
这时我们可以根据需要下载各个版本的Android源码
git checkout android-4.4_r1
这样我们就得到了Android4.4的源码。
我们可以在ADT中关联它的源代码
如果你只想下载Launcher的源代码可以执行以下命令
git clone http://android.googlesource.com/platform/packages/apps/Launcher.git
我们需要哪部分的源码可以单独下载,这样会快点,以下是所有代码下载的列表,可以把下表放在一个shell文件中,作批量下载。
git clone http://android.git.kernel.org/kernel/common.git
git clone http://android.googlesource.com/platform/external/webkit.git
git clone http://android.googlesource.com/platform/development.git
git clone http://android.googlesource.com/platform/system/bluetooth.git
git clone http://android.googlesource.com/platform/external/freetype.git
git clone http://android.googlesource.com/platform/system/vold.git
git clone http://android.googlesource.com/platform/system/extras.git
git clone http://android.googlesource.com/platform/system/core.git
git clone http://android.googlesource.com/platform/frameworks/ex.git
git clone http://android.googlesource.com/platform/system/media.git
git clone http://android.googlesource.com/platform/frameworks/base.git
git clone http://android.googlesource.com/platform/system/netd.git
git clone http://android.googlesource.com/platform/packages/apps/AlarmClock.git
git clone http://android.googlesource.com/platform/packages/apps/Nfc.git
git clone http://android.googlesource.com/platform/system/wlan/ti.git
git clone http://android.googlesource.com/platform/packages/providers/ImProvider.git
git clone http://android.googlesource.com/platform/packages/apps/CertInstaller.git
git clone http://android.googlesource.com/platform/packages/apps/Tag.git
git clone http://android.googlesource.com/platform/packages/providers/TelephonyProvider.git
git clone http://android.googlesource.com/platform/hardware/qcom/media.git
git clone http://android.googlesource.com/platform/packages/providers/WebSearchProvider.git
git clone http://android.googlesource.com/platform/frameworks/opt/carddav.git
git clone http://android.googlesource.com/toolchain/manifest.git
git clone http://android.googlesource.com/toolchain/mpc.git
git clone http://android.googlesource.com/toolchain/build.git
git clone http://android.googlesource.com/device/sample.git
git clone http://android.googlesource.com/toolchain/gmp.git
git clone http://android.googlesource.com/toolchain/gold.git
git clone http://android.googlesource.com/toolchain/gcc.git
git clone http://android.googlesource.com/toolchain/mpfr.git
git clone http://android.googlesource.com/toolchain/benchmark.git
git clone http://android.googlesource.com/toolchain/gdb.git
git clone http://android.googlesource.com/kernel/omap.git
git clone http://android.googlesource.com/platform/packages/apps/Sync.git
git clone http://android.googlesource.com/platform/prebuilt.git
git clone http://android.googlesource.com/platform/dalvik.git
git clone
git clone http://android.googlesource.com/platform/external/tinyxml.git
git clone http://android.googlesource.com/platform/external/srec.git
git clone http://android.googlesource.com/platform/external/neven.git
git clone http://android.googlesource.com/platform/external/dhcpcd.git
git clone http://android.googlesource.com/platform/external/skia.git
git clone http://android.googlesource.com/platform/external/clearsilver.git
git clone http://android.googlesource.com/platform/external/elfutils.git
git clone http://android.googlesource.com/platform/hardware/ril.git
git clone http://android.googlesource.com/platform/external/icu4c.git
git clone http://android.googlesource.com/platform/external/netperf.git
git clone http://android.googlesource.com/platform/external/sqlite.git
git clone http://android.googlesource.com/platform/external/ping.git
git clone http://android.googlesource.com/platform/external/googleclient.git
git clone http://android.googlesource.com/platform/external/tremor.git
git clone http://android.googlesource.com/platform/packages/apps/Settings.git
git clone http://android.googlesource.com/platform/packages/providers/MediaProvider.git
git clone http://android.googlesource.com/platform/packages/apps/Email.git
git clone http://android.googlesource.com/platform/packages/providers/ContactsProvider.git
git clone http://android.googlesource.com/platform/packages/apps/Contacts.git
git clone http://android.googlesource.com/platform/packages/apps/Updater.git
git clone http://android.googlesource.com/platform/packages/apps/Stk.git
git clone http://android.googlesource.com/platform/packages/apps/Camera.git
git clone http://android.googlesource.com/platform/packages/apps/Launcher.git
git clone http://android.googlesource.com/platform/external/safe-iop.git
git clone http://android.googlesource.com/platform/packages/providers/DrmProvider.git
git clone http://android.googlesource.com/platform/external/bluetooth/bluez.git
git clone http://android.googlesource.com/platform/packages/apps/Mms.git
git clone http://android.googlesource.com/platform/packages/apps/Browser.git
git clone http://android.googlesource.com/platform/packages/providers/CalendarProvider.git
git clone http://android.googlesource.com/platform/packages/apps/Calculator.git
git clone http://android.googlesource.com/platform/frameworks/opt/com.google.android.git
git clone http://android.googlesource.com/platform/packages/apps/AccountsAndSyncSettings.git
git clone http://android.googlesource.com/platform/packages/apps/HTMLViewer.git
git clone http://android.googlesource.com/platform/packages/apps/GlobalSearch.git
git clone http://android.googlesource.com/platform/packages/providers/ManagementProvider.git
git clone http://android.googlesource.com/platform/packages/apps/PackageInstaller.git
git clone http://android.googlesource.com/platform/packages/providers/UserDictionaryProvider.git
git clone http://android.googlesource.com/platform/packages/apps/Provision.git
git clone http://android.googlesource.com/platform/packages/apps/Gallery3D.git
git clone http://android.googlesource.com/platform/frameworks/opt/emoji.git
git clone http://android.googlesource.com/platform/packages/apps/Phone.git
git clone http://android.googlesource.com/platform/packages/apps/Gallery.git
git clone http://android.googlesource.com/platform/external/svox.git
git clone http://android.googlesource.com/platform/system/vold.git
git clone http://android.googlesource.com/platform/system/wlan/ti.git
git clone http://android.googlesource.com/platform/packages/providers/ImProvider.git
git clone http://android.googlesource.com/platform/packages/providers/GoogleSubscribedFeedsProvider.git
git clone http://android.googlesource.com/platform/packages/apps/Launcher2.git
git clone http://android.googlesource.com/platform/packages/providers/DownloadProvider.git
git clone http://android.googlesource.com/platform/packages/apps/DeskClock.git
git clone http://android.googlesource.com/platform/packages/apps/SoundRecorder.git
git clone http://android.googlesource.com/platform/packages/apps/Protips.git
git clone http://android.googlesource.com/platform/packages/apps/Stk.git
git clone http://android.googlesource.com/platform/packages/apps/SpeechRecorder.git
git clone http://android.googlesource.com/platform/packages/apps/Music.git
git clone http://android.googlesource.com/platform/packages/apps/VoiceDialer.git
git clone http://android.googlesource.com/platform/packages/providers/GoogleContactsProvider.git
git clone http://android.googlesource.com/platform/packages/apps/IM.git
git clone http://android.googlesource.com/platform/packages/apps/QuickSearchBox.git
git clone http://android.googlesource.com/platform/packages/apps/GoogleSearch.git
git clone http://android.googlesource.com/platform/packages/providers/ApplicationsProvider.git
git clone http://android.googlesource.com/platform/frameworks/opt/com.google.android.googlelogin.git