Android源码下载流程

1.使用repo方式:

https://github.com/jeanboydev/Android-ReadTheFuckingSourceCode/blob/master/article/android/framework/Android-Windows环境下载源码.md

2.使用git方式:

Windows 环境下载 Android 源码-CSDN博客

使用这种方法下载完整源码会占很大空间,如果只是查看源码方便的话,建议删除device/external/prebuilt中空间较大的文件。

python脚本代码:

复制代码
import xml.dom.minidom
import os
from subprocess import call
 
# 1. 修改为源码要保存的路径
rootdir = r"C:\Users\daemon\Desktop\Android_12"
 
# 2. 设置 git 安装的路径
git = r"C:\software\Git\bin\git.exe"

# 3. 修改为第一步中 manifest 中 default.xml 保存的路径
dom = xml.dom.minidom.parse(r"C:\Users\daemon\Desktop\Android_12\manifest\default.xml")
root = dom.documentElement
 
#prefix = git + " clone https://android.googlesource.com/"
# 4. 没有梯子使用清华源下载
prefix = git + " clone https://aosp.tuna.tsinghua.edu.cn/"
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)
相关推荐
apihz4 分钟前
PING 接口 PLUS 全球版 —— 免费全球多节点 Ping 检测 API教程
android
阿pin9 分钟前
Android随笔-epoll机制
android·epoll
plainGeekDev14 分钟前
Gradle 写法 → Kotlin DSL
android·java·kotlin
三少爷的鞋28 分钟前
协程深度解析:明明只有 8 个异步任务,为何 App 线程数瞬间突破 一倍?
android
GitLqr10 小时前
Flutter 3.44 插件内置 Kotlin (KGP) 双向兼容适配指南
android·flutter·dart
随遇丿而安15 小时前
第11周:Activity 跳转与传值 + 跳转优化
android
私人珍藏库16 小时前
[Android] BBLL 开源第三方B哩电视TV端
android·app·生活·工具·多功能
杉氧18 小时前
跨平台资源管理:一套代码如何搞定 Android、iOS 和 Web 的图片与多语言?
android·架构·android jetpack
安卓修改大师19 小时前
安卓修改大师实战:从反编译到定制的完整APK修改指南
android
柚鸥ASO优化20 小时前
安卓APP推广的“降本增效”密码:守好商店内,打好商店外
android·aso优化