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)
相关推荐
敢敢のwings3 小时前
GR00T 2:当机器人学会先想象未来,再决定怎么动
android·机器人
传奇开心果编程3 小时前
【Jetpack Compose娓娓道来】第55课:传感器与设备姿态——把物理世界的数据接进Compose
android·kotlin·移动开发·传感器·jetpack compose·ui框架·声明式ui
传奇开心果编程5 小时前
【Jetpack Compose娓娓道来】第52课:蓝牙与位置权限——把“附近”和“在哪”安全地接进Compose
android·kotlin·移动开发·蓝牙·jetpack compose·声明式ui·位置权限
alexhilton5 小时前
卡顿定位:从 UI 线程到 RenderThread
android·kotlin·android jetpack
FungLeo6 小时前
FengCMS· PHP+MySQL升级实录 · 后台参数统一治理:id[]数组、id=undefined 跳转与312组回调组合
android·mysql·php·工程实践·fengcms
北斗星_And6 小时前
七年后再看 Android 底层:机制没变,路变短了
android·ai编程
王二蛋与他的张大花7 小时前
反编译后只剩 2 个类:一次自研 DEX 壳加固的完整复盘
android·安全·逆向
StarsGreen13 小时前
Android 12 中的“域“与“权限“介绍
android
恋猫de小郭15 小时前
Android Keep Rules 解读,直接影响 Google Play 上架和曝光
android·前端·flutter
FlightYe15 小时前
音视频修炼之容器与协议(六):HTTP 协议
android·linux·网络·网络协议·算法·http·音视频