码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Android源码下载


    在这里插入图片描述


    文章目录

    • 一、Android内核源码下载
    • 二、Android源码下载
    • 三、API 及源码阅读


    一、Android内核源码下载

    国内的镜像

    git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish.git
    
    git branch
    git branch -a
    git checkout -b 2.6.29 remotes/origin/android-goldfish-2.6.29
    
    • 1
    • 2
    • 3
    • 4
    • 5

    android-goldfish-3.4内核源码

    二、Android源码下载

        AOSP 是 Android Open Source Project 的缩写。

    git 常用命令总结
    git 远程仓库相关的操作

    # 查看 remote.origin.url 配置项的值
    git config --list 
    
    • 1
    • 2

    Android9.0之前代码在线查看地址:http://androidxref.com/
    Android9.0之后代码在线查看地址:http://aospxref.com/
    Android Open Source Project


    repo入门
    Android 镜像使用帮助 清华源
    Git Repo 镜像使用帮助 清华源

    # 1
    mkdir ~/bin
    PATH=~/bin:$PATH
    curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
    chmod +x repo
    # 为了方便可以将其拷贝到你的PATH里。
    
    # 2
    export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
    # repo的运行过程中会尝试访问官方的git源更新自己,如果想使用tuna的镜像源进行更新,
    # 可以将如下内容复制到你的~/.bashrc里
    
    # 3
    # 建立工作目录:
    mkdir WORKING_DIRECTORY
    cd WORKING_DIRECTORY
    
    # 初始化仓库:
    repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest
    
    # 如果需要某个特定的 Android 版本(列表):
    repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-4.0.1_r1
    repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-2.3.1_r1
    
    # 同步源码树(以后只需执行这条命令来同步):
    repo sync
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    repo init出现Unable to fully sync the tree


    清华源 manifest
    android源码下载及soong build目录结构解析

    1. 下载源码目录信息
    # 1 下载版本目录
    mkdir Android
    cd Android
    git clone git://http://mirrors.ustc.edu.cn/aosp/platform/manifest
    
    # 2 
    cd manifest
    git tag #(列出安卓版本号)
    git checkout android-5.1.1_r18 ##checkout你想下载的版本号
    # checkout之后,manifest/default.xml文件中记录的就是android5.1系统各个模块的路径
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    1. 编写python下载文件download.py
    import xml.dom.minidom  
    import os  
    from subprocess import call  
    
    #downloaded source path  
    rootdir = "/home/xx/learnAndroid/source/2.3.1"  
    
    #git program path  
    #git = "C:/sun/library/git/Git/bin/git.exe"  
    
    dom = xml.dom.minidom.parse("/home/xx/learnAndroid/source/anGit/manifest/default.xml")  
    root = dom.documentElement  
    
    # prefix = git + " clone https://android.googlesource.com/"  
    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
        print("cmd:", cmd)
        # call(cmd)
        result = os.popen(cmd)
        print(result.read())
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34

    Python调用系统命令的四种方法详解

    1. 执行python文件开始下载
    cmd
    
    python download.py
    
    • 1
    • 2
    • 3

    史上最简最全,Android AOSP源码阅读+编译环境这一篇就够了
    android:自己动手编译Android源码(超详细)
    Android 系统源码下载及编译

    三、API 及源码阅读

    怎么利用Android Studio查看Android-SDK源码

       

  • 相关阅读:
    剑指 Offer 12. 矩阵中的路径
    基于python+nodejs医院急诊挂号系统
    设计文档的Excel转换为对象结构POJO-简式尺规工具箱
    揭开ChatGPT面纱(3):使用OpenAI进行文本情感分析(embeddings接口)
    Java的虚拟线程(协程)特性开启预览阶段,多线程开发的难度将大大降低
    windows批处理笔记一
    JavaScript基础(详细总结)
    AOP、IOC、注解、反射
    @PostConstruct 注解标记的类中,由于ApplicationContext还未加载,导致空指针
    HTML篇一
  • 原文地址:https://blog.csdn.net/Liuqz2009/article/details/133635450
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号