• ubuntu环境下载android源码


    一、 Ubuntu环境

    使用lsb_release -a查看ubuntu版本信息
    在这里插入图片描述

    二、编译使用的工具下载

    安装git

    1、下载git

    sudo apt-get install git 
    
    • 1

    2、配置git

    git config --global user.email "你的电子邮件地址"
    git config --global user.name "你的名字"
    
    • 1
    • 2

    安装repo

    1、下载curl

    sudo apt-get install curl
    
    • 1

    2、新建一个bin目录

    mkdir ~/bin
    
    • 1

    3、将bin目录写入环境变量

    PATH=~/bin:$PATH
    
    • 1

    4、使用curl工具下载repo,并将其放置到bin目录

    curl https://storage-googleapis.lug.ustc.edu.cn/git-repo-downloads/repo > ~/bin/repo
    
    • 1

    5、设置中科大镜像源

    export REPO_URL='https://mirrors.ustc.edu.cn/aosp/git-repo.git/'
    
    • 1

    6、更改repo权限

    chmod a+x ~/bin/repo
    
    • 1

    7、在想创建的位置新建目录,用来下载android源码

    /home/ubuntu/terry/android/android_source/android-7.0
    
    • 1

    8、进入到刚刚创建的文件夹,初始化仓库

    repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest
    
    • 1

    9、如果你只想下载特定的android版本,可以使用如下命令:

    repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-6.0.0_r4
    
    • 1

    执行上述命令的时候,可能会出现以下错误提示:
    在这里插入图片描述
    这是由于国内无法访问google的资源,此时我们需要使用国内的镜像资源。
    1、修改~/.bashrc,添加以下内容
    export REPO_URL=‘https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/’

    vim ~/.bashrc
    
    • 1

    2、执行source ~/.bashrc,使修改生效

    source ~/.bashrc
    
    • 1

    重新执行:repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-6.0.0_r4
    在这里插入图片描述

    9、最后执行sync命令

    repo sync
    
    • 1

    10、下载完成(166G)

    在这里插入图片描述

  • 相关阅读:
    计算机网络和因特网
    基于微信小程序云开(统计学生信息并导出excel)
    Qt——设置布局中特定的两个组件之间的间距
    夜神模拟器微信扫码
    Java——正则表达式
    Spring之简单工厂模式 工厂方法模式
    realityOS会是苹果的新操作系统吗?
    类加载过程
    Rust宏详解之类函数宏
    基于Qt Designer和PyQt5的桌面软件开发--环境搭建和入门例子
  • 原文地址:https://blog.csdn.net/u011557841/article/details/125418576