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)
相关推荐
数据知道1 小时前
移动端渗透测试流程:Android APK 逆向与动态调试
android·web安全·网络安全
我命由我123453 小时前
人脸识别 - 勒克斯(光线照射到物体表面上的明亮程度)
android·java·学习·java-ee·人脸识别·学习方法·android runtime
聚美智数3 小时前
护照OCR识别-护照图像识别-护照OCR文字识别-护照识别OCR-护照信息识别-护照OCR
android·ocr
码农coding5 小时前
android12 点击桌面应用图标启动Activity流程
android
johnsong6 小时前
深度拆解:150M循环模型如何用循环推理击败大Transformer
android·深度学习·transformer
CedarQR7 小时前
云卓 G20 遥控器 Android 开发实录:从 USB 设备到读取摇杆/按键通道值
android·linux·无人机
pengyu7 小时前
【Kotlin 协程修仙录 · 炼虚境 · 初阶】 | 虚空造物:Channel 基础与协程间通信的管道艺术
android·前端·kotlin
小强闯江湖7 小时前
ViewCompose:让原生 Android View 进入声明式时代
android·开源·kotlin
摇滚侠10 小时前
《SpringBoot 3:入门与应用实战》第 6 章 Spring Boot 最佳实践 阅读笔记 12
android·spring boot·笔记
mmsx10 小时前
Android 宠物健康服务平台实战:从架构设计到主题换肤完整解析(源码和文档)
android·架构·sqlite·app·源码·宠物