最近在看《android内核剖析》,很多细节不具体看代码很难理解,记住了印象也不深,感觉还是跟着源码走一遍好些,回来下载android源码,遇到不少问题,终于开始下载了,整理下流程,鉴于网上很多教程时间久了都会失效,本文截止14年4月18日亲测有效。
需要工具如下:
74.125.31.82 www.googlesource.com 74.125.31.82 android.googlesource.com 203.208.46.172 cache.pack.google.com 59.24.3.173cache.pack.google.com
输入命令,切换到manifest目录
cd manifest
git tag 列出android各个分支版本
下载android-4.4系统源码,输入下面命令,如果要下载其他版本源码,checkout git tag列出的版本号即可
git checkout android-4.4.2_r1
import xml.dom.minidom import os from subprocess import call #downloaded source path rootdir = "D:/android-source" #git program path git = "D:/Program Files/Git/bin/git.exe" dom = xml.dom.minidom.parse("D:/manifest/default.xml") root = dom.documentElement prefix = git + " clone https://android.googlesource.com/" suffix = ".git" if not os.path.exists(rootdir): os.mkdir(rootdir) for node in root.getElementsByTagName("project"): os.chdir(rootdir) d = node.getAttribute("path") last = d.rfind("/") if last != -1: d = rootdir + "/" + d[:last] if not os.path.exists(d): os.makedirs(d) os.chdir(d) cmd = prefix + node.getAttribute("name") + suffix call(cmd)
windows平台下载android源码,布布扣,bubuko.com
原文:http://blog.csdn.net/jason0539/article/details/24010633