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)
相关推荐
2501_916008891 小时前
苹果上架工具怎么选 不用 Mac 上架 App Store 的几种方案
android·macos·ios·小程序·uni-app·iphone·webview
jijihusong0063 小时前
KMP全栈开发教程:从Android到AI Agent
android·人工智能
_祝你今天愉快4 小时前
Android Binder 驱动 - 内核驱动层源码初探
android
stevenzqzq5 小时前
【无标题】
android
梦幻通灵6 小时前
Notepad++格式化Json两种方案【持续更新】
android·json·notepad++
1024+6 小时前
YOLO 转 RKNN 识别率降低调优操作手册(新手篇)
android·yolo·kotlin
木易 士心7 小时前
深度解析 Android 音频焦点处理与实战开发
android·音视频
祉猷并茂,雯华若锦8 小时前
Appium 3.x安卓APP企业级安装实战
android·appium
微露清风9 小时前
浅析 MySQL 索引
android·数据库·mysql
91刘仁德9 小时前
MySQL 数据类型详解
android·笔记·mysql·adb