码农知识堂 - 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源码

       

  • 相关阅读:
    BFC以及清除浮动四种方式
    setContentView源码解析
    QT基础 柱状图
    VMware安装虚拟机ubuntu
    Docker 安装 Nginx
    2022年最新互联网大厂92题高频面试题,直接吊打面试官!
    RabbitMQ部署及使用
    HCIA --- ACL(访问控制列表)
    3.k8s核心概念
    数据结构 树练习题
  • 原文地址:https://blog.csdn.net/Liuqz2009/article/details/133635450
  • 最新文章
  • 【JVM】编译执行与解释执行的区别是什么?JVM 使用哪种方式?
    用 Hashids 优雅解决 C 端自增 ID 暴露问题
    V8引擎 精品漫游指南--Ignition篇(上) 指令 栈帧 槽位 调用约定 内存布局 基础内容
    LLVM Pass快速入门(四):代码插桩
    milkup:桌面端 markdown AI续写和即时渲染
    基于项目工程构建SBOM(软件物料清单)的研究
    鸿蒙应用开发UI基础第二节:鸿蒙应用程序框架核心解析与实操
    .NET 中如何快速实现 List 集合去重?
    扣子Coze实战:从0到1打造抖音+小红书热点监控智能体
    浅谈数据访问层
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号