windows平台下载android源码
2015-02-12 22:32
459 查看
最近在看《android内核剖析》,很多细节不具体看代码很难理解,记住了印象也不深,感觉还是跟着源码走一遍好些,回来下载android源码,遇到不少问题,终于开始下载了,整理下流程,鉴于网上很多教程时间久了都会失效,本文截止14年4月18日亲测有效。
需要工具如下:
下载msysgit,安装 官方下载:http://download.csdn.net/detail/jason0539/7212993,
下载python,安装 官方网址:http://www.python.org
打开Git Bash,执行命令,我是放在d盘的,路径可自定义
cd D:
git clone https://android.googlesource.com/platform/manifest.git
这里会遇到问题,说你连接不上站点,错误代码443
解决方案,在电脑的hosts文件中添加如下几行,不知道hosts在哪的自行百度
[java] view
plaincopyprint?
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目录
git tag 列出android各个分支版本
下载android-4.4系统源码,输入下面命令,如果要下载其他版本源码,checkout git tag列出的版本号即可
checkout之后,manifest/default.xml文件中记录的就是android4.4系统各个模块的路径,
下面就轮到python出场了,这里用的是网上的一段python代码,实现源码的批量下载
执行此脚本的前提是已经执行了git checkout,选择好了要下载的Android源码版本,如果你的manifest文件不是D:/manifest/default.xml,还要把里面的git.exe的路经修改成你的安装路径,请自行修改脚本。
download-src.py源码:
[python] view
plaincopyprint?
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)
执行这个脚本之后,就开始自动下载了,
截张图:
估计需要一段时间,耐心等待。
转载自:http://blog.csdn.net/jason0539
需要工具如下:
下载msysgit,安装 官方下载:http://download.csdn.net/detail/jason0539/7212993,
下载python,安装 官方网址:http://www.python.org
打开Git Bash,执行命令,我是放在d盘的,路径可自定义
cd D:
git clone https://android.googlesource.com/platform/manifest.git
这里会遇到问题,说你连接不上站点,错误代码443
解决方案,在电脑的hosts文件中添加如下几行,不知道hosts在哪的自行百度
[java] view
plaincopyprint?
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
checkout之后,manifest/default.xml文件中记录的就是android4.4系统各个模块的路径,
下面就轮到python出场了,这里用的是网上的一段python代码,实现源码的批量下载
执行此脚本的前提是已经执行了git checkout,选择好了要下载的Android源码版本,如果你的manifest文件不是D:/manifest/default.xml,还要把里面的git.exe的路经修改成你的安装路径,请自行修改脚本。
download-src.py源码:
[python] view
plaincopyprint?
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)
执行这个脚本之后,就开始自动下载了,
截张图:
估计需要一段时间,耐心等待。
转载自:http://blog.csdn.net/jason0539
相关文章推荐
- Windows平台下Android源码的下载
- Windows平台下Android源码的下载
- Windows平台下Android源码的下载
- windows平台下下载Android源码
- windows平台使用 git 下载android源码
- Windows平台下Android源码的下载
- 【转】Windows平台下Android源码的下载
- 最新Windows平台下Android源码的下载(转+原)
- Windows平台下Android源码的下载
- Windows平台下最新Android源码下载
- Windows平台下Android源码的下载
- windows平台下载Android源码
- Windows平台下载Android源码
- windows平台下载Android源码
- windows平台下载android源码
- android源码在windows平台下的下载的几种方式
- Windows平台下载Android源码