打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Windows下载Android源码
下载msysgit,安装     官方下载:http://code.google.com/p/msysgit/downloads/list
 下载python,安装      官方网址:http://www.python.org
 
打开Git Bash,执行命令

 

输入命令,切换到manifest目录

cd manifest

git tag 列出android各个分支版本

git tag

下载android-4.1系统源码,输入下面命令,如果要下载其他版本源码,checkout git tag列出的版本号即可

git checkout android-4.1.1_r4
checkout之后,manifest/default.xml文件中记录的就是android2.2系统各个模块的路径 
       我们来分析一下default.xml文件,
       以bionic为例,path属性表示bionic源码的相对路径,假设android源码在d:/android-source,下载bionic之后,应该存放在d:/android-source/bionic目录name属性是bionic源代码在库上的路径,完整的路径就是:http://android.googlesource.com/platform/bionic.git,有了源码下载路径,执行git clone就可以将bionic源码下载到本地<project path="bionic" name="platform/bionic" />Android源码中project很多,一个一个下载比较麻烦,本人写了一个python脚本,双击download-src.py执行此脚本,就可以将android完整源码下载到本地。
         PS:执行此脚本的前提是已经执行了git checkout,选择好了要下载的Android源码版本,如果你的manifest文件不是D:/manifest/default.xml,请自行修改脚本。download-src.py源码:
import xml.dom.minidomimport osfrom subprocess import call#downloaded source pathrootdir = "D:/android-source"#git program pathgit = "D:/Program Files/Git/bin/git.exe"dom = xml.dom.minidom.parse("D:/manifest/default.xml")root = dom.documentElementprefix = 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)




本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
搭建自己的Android源码仓库 | 飞熊在天
Android系统定制之源码完美下载(一)
使用repo下载google 的android4.4 源码,跟编译
Get source ?(Android Open Source Project?)
Android 4.4 全套源码及子模块源码的下载方法
Repo 详解
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服