原文来自于:http://blog.csdn.net/hlf48641715/article/details/7188450

下载msysgit,安装

官方下载:http://code.google.com/p/msysgit/downloads/list

打开Git Bash,执行命令

cd D:

git clone https://android.googlesource.com/platform/manifest.git

输入命令,切换到manifest目录

cd manifest

git tag 列出android各个分支版本

git tag

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

git checkout android-2.2_r1

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.minidom
import os
from 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.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源码的更多相关文章

  1. Windows平台下载Android源码(整理)

    Google官方下载源码使用的系统Ubuntu系统,不过现在我们需要在Windows系统中下载Android源码文件. 网站的地址是:https://android.googlesource.com/ ...

  2. 【Linux/Ubuntu学习6】unbuntu 下载android源码

    在Windows下安装Cygwin,通过Cygwin也可在Windows里通过本文的下载步骤下载Android源码. 以下为在Ubuntu下下载Google Android4.4源码的步骤: 1. 安 ...

  3. 通过清华大学镜像下载Android源码并编译源码

    之前看源码都是在Windows下用SourceInsight看,虽然达到了研究源码的效果,但终究还是有遗憾...趁着周末,准备在Ubuntu虚拟机上下载编译源码. 之前下源码时,有了解一些Androi ...

  4. 下载android源码

    http://source.android.com Step 1.按照http://source.android.com/source/initializing.html配置好android编译环境 ...

  5. [Android] repo 下载Android源码(国内镜像)

    reference : http://blog.csdn.net/shenlan18446744/article/details/51490560 repo 下载Android源码(国内镜像) 下载r ...

  6. (国内)完美下载Android源码Ubuntu版

    今天写的文章莫名奇妙的没了,所以再重新写一篇. 首先,为了方便起见,我已经将系统更换成里Ubuntu,因为官方推荐使用这个Linux发行版.先来一张系统的截图: Ubuntu的版本是16.04(推荐用 ...

  7. 如何下载android源码与android内核源码

    首先,要分清楚,android的源代码和android的内核代码一般是分开的,要分别进行下载. 1.先下载android的源代码.(这里不包括android的内核代码)      下载最新的源代码,一 ...

  8. 安装ubuntu16虚拟机,下载android源码,配置编译环境

    Android 源码编译步骤: 我考虑了一下,目前电脑装了SSD,8G内存,使用虚拟机编译源码应该够用. 首先下载虚拟机软件,由于最近一直在使用virtualbox,感觉蛮不错了,下载地址: http ...

  9. 快速下载android源码

    众所周知的原因,android源码被墙了,还好国内有不少镜像,这里使用清华提供的镜像. 以下内容转自: https://wiki.tuna.tsinghua.edu.cn/MirrorUsage/an ...

随机推荐

  1. cf701A Cards

    There are n cards (n is even) in the deck. Each card has a positive integer written on it. n / 2 peo ...

  2. libvirt 命令行交互工具之virsh

    libvirt是当前主流VM最低层库.IBM PowerVM也不例外,libvirt是深入玩虚拟化必须玩转的东西; 简单测试玩玩libvirt 的virsh命令行交互工具, 你我都知libvirt大体 ...

  3. win7安装ruby on rails

    开发机:win7 旗舰版 - 64位 1,安装ruby,下载rubyinstaller-2.0.0-p451.exe 下载地址:http://rubyinstaller.org/downloads/ ...

  4. java笔记9之switch

    switch语句的注意事项:        A:case后面只能是常量,不能是变量,而且,多个case后面的值不能出现相同的        B:default可以省略吗?            可以省 ...

  5. Asp.Net Webapi路由基本设置

    1.直接在Global.asax中添加配置 如: using MvcApplication4.App_Start; using System; using System.Collections.Gen ...

  6. 3分钟学会sessionStorage用法(h5页面返回滚动到上次浏览器位置)

    前言: 因最近移动端开发过程中遇到一个运营提出的所谓技术难点需求,对于原生APP来说轻而易举,毕竟自己的APP用户操作指哪打哪,但是H5该怎么做?H5就实现不了么?对于一个爱研究攻克这些前端棘手问题的 ...

  7. XML FREESWITCH APPLICATION 实现

    XML XML在FS(FreeSwitch)中进行了大量的使用,其中dialplan就是其中非常主要的一快内容.通过下面的描述,我们可以知道在执行XML中的语句: <action applica ...

  8. DHTML【1】

       什么是DHTML呢?英文全称(Dynamic Hypertext Markup Language),即动态超文本标记语言,DHTML不是一个独立的新技术,而是多种技术的综合,它能使HTML变的更 ...

  9. Chapter 4. Using the Gradle Command-Line 使用gradle命令行

    This chapter introduces the basics of the Gradle command-line. You run a build using the gradle comm ...

  10. Jsp笔记(1)

    1. jsp页面中出现中文乱码怎么解决? <%@ page contentType="text/html; charset=GB2312"%> <%@ page ...