admin管理员组文章数量:1130349
1.安装 git
官网:https://git-scm/downloads/
2.安装 Python
官网:https://www.python/downloads/
3.下载源码
1.下载manifest.git
方法一:git clone https://android.googlesource/platform/manifest.git(需要梯子)
方法二:git clone https://aosp.tuna.tsinghua.edu/platform/manifest.git(清华源,不需要梯子)
2.checkout分支
git checkout 分支号 (分支号:切换到刚下载的manifest目录下,git bash使用git branch -a显示所有分支)
切换成功后会显示:You are in 'detached HEAD' state. You can look around, make experimental......
3.使用 Python 执行脚本进行源代码下载
1.创建文件 python_download.py,将下面代码复制进去 ,记得修改代码中路径
import xml.dom.minidom
import os
from subprocess import call
# 1. 修改为源码要保存的路径
rootdir = "G:/android_source"
# 2. 设置 git 安装的路径
git = "C:/Program Files (x86)/Git/bin/git.exe"
# 3. 修改为第一步中 manifest 中 default.xml 保存的路径
dom = xml.dom.minidom.parse("G:/android_source/manifest/default.xml")
root = dom.documentElement
#prefix = git + " clone https://android.googlesource/"
# 4. 没有梯子使用清华源下载
prefix = git + " clone https://aosp.tuna.tsinghua.edu/"
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)
1.安装 git
官网:https://git-scm/downloads/
2.安装 Python
官网:https://www.python/downloads/
3.下载源码
1.下载manifest.git
方法一:git clone https://android.googlesource/platform/manifest.git(需要梯子)
方法二:git clone https://aosp.tuna.tsinghua.edu/platform/manifest.git(清华源,不需要梯子)
2.checkout分支
git checkout 分支号 (分支号:切换到刚下载的manifest目录下,git bash使用git branch -a显示所有分支)
切换成功后会显示:You are in 'detached HEAD' state. You can look around, make experimental......
3.使用 Python 执行脚本进行源代码下载
1.创建文件 python_download.py,将下面代码复制进去 ,记得修改代码中路径
import xml.dom.minidom
import os
from subprocess import call
# 1. 修改为源码要保存的路径
rootdir = "G:/android_source"
# 2. 设置 git 安装的路径
git = "C:/Program Files (x86)/Git/bin/git.exe"
# 3. 修改为第一步中 manifest 中 default.xml 保存的路径
dom = xml.dom.minidom.parse("G:/android_source/manifest/default.xml")
root = dom.documentElement
#prefix = git + " clone https://android.googlesource/"
# 4. 没有梯子使用清华源下载
prefix = git + " clone https://aosp.tuna.tsinghua.edu/"
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系统源码 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/jiaocheng/1760050124a2842659.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论