Google开放了Android的源码 。 源码采用Git进行版本控制。
1. 首先,到
http://code.google.com/p/msysgit/downloads/list
下载Git-xxx.exe,下载完成后安装Git。
2. Android代码仓库的地址
http://git.source.android.com
访问该地址。
可以看到Android项目中,所有的包的列表。
单个包源码的下载方式:
创建目录,运行Git,在Git提供的shell,切换路径到你刚才创建的目录下(cd命令),然后运行下表命令(以common.git为例)
git clone git://android.git.kernel.org/kernel/common.git
3.在linux下可以使用repo批量下载,可惜的是repo没有windows版本。
4. windows直可以使用批量脚本。脚本文本如下,持贝以下字符一个文本文件中,命名为:autoget.sh,将该文本保存到用来下载源码的目录中。运行Git,在Git提供的shell,切换路径到你刚才创建的目录下(cd命令),运行./autogit.sh
#Create by CreatAutoGetSh
mkdir kernel
cd kernel
git clone git://android.git.kernel.org/kernel/common.git
git clone git://android.git.kernel.org/kernel/experimental.git
git clone git://android.git.kernel.org/kernel/msm.git
git clone git://android.git.kernel.org/kernel/omap.git
cd ..
mkdir platform
cd platform
git clone git://android.git.kernel.org/platform/bionic.git
mkdir bootable
cd bootable
mkdir bootloader
cd bootloader
git clone git://android.git.kernel.org/platform/bootable/bootloader/legacy.git
cd ..
git clone git://android.git.kernel.org/platform/bootable/diskinstaller.git
git clone git://android.git.kernel.org/platform/bootable/recovery.git
cd ..
mkdir bootloader
cd bootloader
git clone git://android.git.kernel.org/platform/bootloader/legacy.git
cd ..
git clone git://android.git.kernel.org/platform/build.git
git clone git://android.git.kernel.org/platform/dalvik.git
git clone git://android.git.kernel.org/platform/development.git
mkdir external
cd external
git clone git://android.git.kernel.org/platform/external/aes.git
git clone git://android.git.kernel.org/platform/external/alsa-lib.git
git clone git://android.git.kernel.org/platform/external/alsa-utils.git
git clone git://android.git.kernel.org/platform/external/apache-http.git
git clone git://android.git.kernel.org/platform/external/astl.git
git clone git://android.git.kernel.org/platform/external/bison.git
git clone git://android.git.kernel.org/platform/external/bluez.git
git clone git://android.git.kernel.org/platform/external/bsdiff.git
git clone git://android.git.kernel.org/platform/external/bzip2.git
git clone git://android.git.kernel.org/platform/external/clearsilver.git
git clone git://android.git.kernel.org/platform/external/dbus.git
git clone git://android.git.kernel.org/platform/external/dhcpcd.git
git clone git://android.git.kernel.org/platform/external/dosfstools.git
git clone git://android.git.kernel.org/platform/external/dropbear.git
git clone git://android.git.kernel.org/platform/external/e2fsprogs.git
git clone git://android.git.kernel.org/platform/external/eglib.git
git clone git://android.git.kernel.org/platform/external/elfcopy.git
git clone git://android.git.kernel.org/platform/external/elfutils.git
git clone git://android.git.kernel.org/platform/external/embunit.git
git clone git://android.git.kernel.org/platform/external/emma.git
git clone git://android.git.kernel.org/platform/external/esd.git
git clone git://android.git.kernel.org/platform/external/expat.git
git clone git://android.git.kernel.org/platform/external/fdlibm.git
git clone git://android.git.kernel.org/platform/external/freetype.git
git clone git://android.git.kernel.org/platform/external/fsck_msdos.git
git clone git://android.git.kernel.org/platform/external/gdata.git
git clone git://android.git.kernel.org/platform/external/genext2fs.git
git clone git://android.git.kernel.org/platform/external/giflib.git
git clone git://android.git.kernel.org/platform/external/googleclient.git
git clone git://android.git.kernel.org/platform/external/grub.git
git clone git://android.git.kernel.org/platform/external/gtest.git
git clone git://android.git.kernel.org/platform/external/hcidump.git
git clone git://android.git.kernel.org/platform/external/icu4c.git
git clone git://android.git.kernel.org/platform/external/iptables.git
git clone git://android.git.kernel.org/platform/external/jdiff.git
git clone git://android.git.kernel.org/platform/external/jhead.git
git clone git://android.git.kernel.org/platform/external/jpeg.git
git clone git://android.git.kernel.org/platform/external/junit.git
git clone git://android.git.kernel.org/platform/external/lcc.git
git clone git://android.git.kernel.org/platform/external/libffi.git
git clone git://android.git.kernel.org/platform/external/libpcap.git
git clone git://android.git.kernel.org/platform/external/libpng.git
git clone git://android.git.kernel.org/platform/external/libxml2.git
git clone git://android.git.kernel.org/platform/external/mtpd.git
git clone git://android.git.kernel.org/platform/external/netcat.git
git clone git://android.git.kernel.org/platform/external/netperf.git
git clone git://android.git.kernel.org/platform/external/neven.git
git clone git://android.git.kernel.org/platform/external/opencore.git
git clone git://android.git.kernel.org/platform/external/openssl.git
git clone git://android.git.kernel.org/platform/external/oprofile.git
git clone git://android.git.kernel.org/platform/external/ping.git
git clone git://android.git.kernel.org/platform/external/ppp.git
git clone git://android.git.kernel.org/platform/external/protobuf.git
git clone git://android.git.kernel.org/platform/external/qemu.git
git clone git://android.git.kernel.org/platform/external/safe-iop.git
git clone git://android.git.kernel.org/platform/external/skia.git
git clone git://android.git.kernel.org/platform/external/sonivox.git
git clone git://android.git.kernel.org/platform/external/sqlite.git
git clone git://android.git.kernel.org/platform/external/srec.git
git clone git://android.git.kernel.org/platform/external/strace.git
git clone git://android.git.kernel.org/platform/external/tagsoup.git
git clone git://android.git.kernel.org/platform/external/tcpdump.git
git clone git://android.git.kernel.org/platform/external/tesseract.git
git clone git://android.git.kernel.org/platform/external/tinyxml.git
git clone git://android.git.kernel.org/platform/external/tremor.git
git clone git://android.git.kernel.org/platform/external/webkit.git
git clone git://android.git.kernel.org/platform/external/wpa_supplicant.git
git clone git://android.git.kernel.org/platform/external/xdelta3.git
git clone git://android.git.kernel.org/platform/external/yaffs2.git
git clone git://android.git.kernel.org/platform/external/zlib.git
cd ..
mkdir frameworks
cd frameworks
git clone git://android.git.kernel.org/platform/frameworks/base.git
mkdir opt
cd opt
git clone git://android.git.kernel.org/platform/frameworks/opt/com.google.android.git
git clone git://android.git.kernel.org/platform/frameworks/opt/com.google.android.googlelogin.git
git clone git://android.git.kernel.org/platform/frameworks/opt/emoji.git
cd ..
mkdir policies
cd policies
git clone git://android.git.kernel.org/platform/frameworks/policies/base.git
cd ..
cd ..
mkdir hardware
cd hardware
git clone git://android.git.kernel.org/platform/hardware/alsa_sound.git
git clone git://android.git.kernel.org/platform/hardware/libhardware.git
git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git
git clone git://android.git.kernel.org/platform/hardware/msm7k.git
git clone git://android.git.kernel.org/platform/hardware/ril.git
cd ..
git clone git://android.git.kernel.org/platform/manifest.git
mkdir packages
cd packages
mkdir apps
cd apps
git clone git://android.git.kernel.org/platform/packages/apps/AlarmClock.git
git clone git://android.git.kernel.org/platform/packages/apps/Browser.git
git clone git://android.git.kernel.org/platform/packages/apps/Calculator.git
git clone git://android.git.kernel.org/platform/packages/apps/Calendar.git
git clone git://android.git.kernel.org/platform/packages/apps/Camera.git
git clone git://android.git.kernel.org/platform/packages/apps/Contacts.git
git clone git://android.git.kernel.org/platform/packages/apps/Email.git
git clone git://android.git.kernel.org/platform/packages/apps/GoogleSearch.git
git clone git://android.git.kernel.org/platform/packages/apps/HTMLViewer.git
git clone git://android.git.kernel.org/platform/packages/apps/IM.git
git clone git://android.git.kernel.org/platform/packages/apps/Launcher.git
git clone git://android.git.kernel.org/platform/packages/apps/Mms.git
git clone git://android.git.kernel.org/platform/packages/apps/Music.git
git clone git://android.git.kernel.org/platform/packages/apps/OTAProvisioningClient.git
git clone git://android.git.kernel.org/platform/packages/apps/PackageInstaller.git
git clone git://android.git.kernel.org/platform/packages/apps/Phone.git
git clone git://android.git.kernel.org/platform/packages/apps/Settings.git
git clone git://android.git.kernel.org/platform/packages/apps/SoundRecorder.git
git clone git://android.git.kernel.org/platform/packages/apps/Stk.git
git clone git://android.git.kernel.org/platform/packages/apps/Sync.git
git clone git://android.git.kernel.org/platform/packages/apps/Updater.git
git clone git://android.git.kernel.org/platform/packages/apps/VoiceDialer.git
cd ..
mkdir inputmethods
cd inputmethods
git clone git://android.git.kernel.org/platform/packages/inputmethods/LatinIME.git
git clone git://android.git.kernel.org/platform/packages/inputmethods/OpenWnn.git
git clone git://android.git.kernel.org/platform/packages/inputmethods/PinyinIME.git
cd ..
mkdir providers
cd providers
git clone git://android.git.kernel.org/platform/packages/providers/ApplicationsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/CalendarProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/ContactsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/DownloadProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/DrmProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/GoogleContactsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/GoogleSubscribedFeedsProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/ImProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/MediaProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/TelephonyProvider.git
git clone git://android.git.kernel.org/platform/packages/providers/UserDictionaryProvider.git
cd ..
cd ..
git clone git://android.git.kernel.org/platform/prebuilt.git
git clone git://android.git.kernel.org/platform/recovery.git
mkdir system
cd system
git clone git://android.git.kernel.org/platform/system/bluetooth.git
git clone git://android.git.kernel.org/platform/system/core.git
git clone git://android.git.kernel.org/platform/system/extras.git
mkdir wlan
cd wlan
git clone git://android.git.kernel.org/platform/system/wlan/broadcom.git
git clone git://android.git.kernel.org/platform/system/wlan/ti.git
cd ..
cd ..
mkdir vendor
cd vendor
mkdir asus
cd asus
git clone git://android.git.kernel.org/platform/vendor/asus/eee_701.git
cd ..
mkdir csr
cd csr
git clone git://android.git.kernel.org/platform/vendor/csr/unifi-105x.git
git clone git://android.git.kernel.org/platform/vendor/csr/unifi-60xx.git
cd ..
mkdir htc
cd htc
git clone git://android.git.kernel.org/platform/vendor/htc/dream-open.git
cd ..
mkdir qcom
cd qcom
git clone git://android.git.kernel.org/platform/vendor/qcom/surf.git
cd ..
cd ..
cd ..
mkdir tools
cd tools
git clone git://android.git.kernel.org/tools/android-issuetrackerredirect.git
git clone git://android.git.kernel.org/tools/executablewar.git
git clone git://android.git.kernel.org/tools/gerrit-contactstore.git
git clone git://android.git.kernel.org/tools/gerrit-keyapplet.git
git clone git://android.git.kernel.org/tools/gerrit.git
git clone git://android.git.kernel.org/tools/gimd.git
git clone git://android.git.kernel.org/tools/gwtexpui.git
git clone git://android.git.kernel.org/tools/gwtjsonrpc.git
git clone git://android.git.kernel.org/tools/gwtorm.git
git clone git://android.git.kernel.org/tools/manifest.git
git clone git://android.git.kernel.org/tools/protobuf.git
git clone git://android.git.kernel.org/tools/repo.git
mkdir test
cd test
git clone git://android.git.kernel.org/tools/test/manifest.git
git clone git://android.git.kernel.org/tools/test/project0.git
5. Android的代码库结构改变后,以上脚本将不能适应改变后的结构。
解决办法:下载自动生产脚本。