admin管理员组文章数量:1794759
Windows 环境下载 Android 源码
Windows 环境下载 Android 源码 前言
Android 官网(该方式不适合 Windows 平台):source.android/source/downloading.html
可是我就想在 Windows 中使用 Source Insight 看看源代码,当然可以!
准备环境官网:git-scm/downloads/
图形化工具:tortoisegit/
什么?不会安装 git,那还看什么源码!自行百度!
2. 安装 Python官网:www.python/downloads/
安装参考:jingyan.baidu/article/c910274be14d64cd361d2dd8.html
只需要安装好运行环境即可
3. 自备梯子没有梯子?那就使用清华源:mirrors.tuna.tsinghua.edu/help/AOSP/
下载源码 1. 打开 Git Bash,用 git 克隆源代码仓库 git clone android.googlesource/platform/manifest.git //没有梯子使用清华源 git clone aosp.tuna.tsinghua.edu/platform/manifest.git这时 D:/android_source_code/ 目录下会出现一个 manifest 目录,进入此目录,里面除了 git 的配置目录外,clone 下来了一个 default.xml 文件。
2. 切换到想要的源码版本分支去这里 source.android/source/build-numbers.html#source-code-tags-and-builds
找到想要的版本分支,并复制。
cd manifest //没有梯子,使用 git branch -a 查看所有分支,找到想要的分支 git branch -a git checkout android-6.0.1_r79 //这里以 6.0 最后一个版本下载 3. 使用 Python 执行脚本进行源代码下载将下面的代码复制,创建文件 python_download.py,并保存。
import xml.dom.minidom import os from subprocess import call # 1. 修改为源码要保存的路径 rootdir = "D:/android_source_code/Android_6_0_1" # 2. 设置 git 安装的路径 git = "C:/Develop/Git/bin/git.exe" # 3. 修改为第一步中 manifest 中 default.xml 保存的路径 dom = xml.dom.minidom.parse("D:/android_source_code/manifest/default.xml") root = dom.documentElement #prefix = git + " clone android.googlesource/" # 4. 没有梯子使用清华源下载 prefix = git + " clone 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) 4. 执行 Python 脚本开始下载打开 Python 客户端
打开上一步保存的 python_download.py 脚本文件
点击 Run->Run Module 来运行脚本,或直接按F5运行。
静静地等待下载完成吧。
更多文章:github/jeanboydev/Android-ReadTheFuckingSourceCode
我的公众号欢迎你「扫一扫」下面的二维码,关注我的公众号,可以接受最新的文章推送,有丰厚的抽奖活动和福利等着你哦!?
如果你有什么疑问或者问题,可以 点击这里 提交 issue,也可以发邮件给我 jeanboy@foxmail。
同时欢迎你 来一起交流学习,群里有很多大牛和学习资料,相信一定能帮助到你!
版权声明:本文标题:Windows 环境下载 Android 源码 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686527021a77953.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论