admin管理员组文章数量:1614268
- 一个好的文章能够帮助开发者完成更便捷、更快速的开发。
- 书山有路勤为径,学海无涯苦作舟。我是秋知叶i、期望每一个阅读了我的文章的开发者都能够有所成长。
【Android 系统】--- 下载 Android源码超详细
- 开发环境
- 一、下载工具
- 二、创建git账户
- 三、特别说明
- 四、下载最新 AOSP 源码
- 1、初始化仓库
- 2、同步源码
- 5:下载特定版本 AOSP 源码
- 1、初始化仓库
- 2、出现错误
- 3、同步源码
- 五、脚本
开发环境
开发环境:Ubuntu16.04
一、下载工具
AOSP:Android Open-Source Project"的缩写。中文意为"Android 开放源代码项目。
需要的工具 repo 搭建repo教程
二、创建git账户
- 账户名
git config --global user.name "Your Name"
- 账户邮箱
git config --global user.email "email@example"
三、特别说明
- 可能会出现报错
git error:error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
- 解决方法:
git config --global http.postBuffer 2000000000
四、下载最新 AOSP 源码
1、初始化仓库
repo init -u https://mirrors.tuna.tsinghua.edu/git/AOSP/platform/manifest
2、同步源码
repo sync
5:下载特定版本 AOSP 源码
1、初始化仓库
-
需要同步特定的 Android源码版本 比如android-6.0.1_r22
-
在后面加 -b 参数 再加上自己想要的版本
-
Android版本列表
-
加上–depth=1 --platform=auto参数可以大幅度增加下载速度
repo init -u https://mirrors.tuna.tsinghua.edu/git/AOSP/platform/manifest -b android-6.0.1_r22 --depth=1 --platform=auto
2、出现错误
repo /usr/bin/env: “python”: 没有那个文件或目录
在这里我直接选择 N
icedustpan@Vbox:~/aosp/android-6.0.1_r22$ repo init -u https://mirrors.tuna.tsinghua.edu/git/AOSP/platform/manifest -b android-6.0.1_r22
Downloading Repo source from https://mirrors.tuna.tsinghua.edu/git/git-repo
remote: Enumerating objects: 6734, done.
remote: Counting objects: 100% (6734/6734), done.
remote: Compressing objects: 100% (3496/3496), done.
remote: Total 6734 (delta 4333), reused 5241 (delta 3165)
接收对象中: 100% (6734/6734), 2.93 MiB | 4.27 MiB/s, 完成.
处理 delta 中: 100% (4333/4333), 完成.
repo: Updating release signing keys to keyset ver 2.3
Downloading manifest from https://mirrors.tuna.tsinghua.edu/git/AOSP/platform/manifest
remote: Enumerating objects: 4583, done.
remote: Counting objects: 100% (4583/4583), done.
remote: Compressing objects: 100% (3890/3890), done.
remote: Total 89936 (delta 2164), reused 93 (delta 21)
接收对象中: 100% (89936/89936), 21.15 MiB | 5.96 MiB/s, 完成.
处理 delta 中: 100% (33616/33616), 完成.
Your identity is: icedustpan <icedustpan@163.com>
If you want to change this, please re-run 'repo init' with --config-name
Testing colorized output (for 'repo diff', 'repo status'):
black red green yellow blue magenta cyan white
bold dim ul reverse
Enable color display in this user account (y/N)? N
repo has been initialized in /home/icedustpan/aosp/android-6.0.1_r22
3、同步源码
repo init时加上–depth=1 参数,下载的代码每个git仓只包含一个commit信息,repo sync时加上-c参数,只下载当前分支相关的代码,二者结合起来,可以大大缩小整个工程的代码,
repo sync -c -j4
五、脚本
repo sync 断点自动下载脚本
#!/bin/bash
repo sync -c -j4
while [ $? -ne 0 ]
do
echo "----------sync failed----------"
sleep 10
repo sync -c -j4
done
版权声明:本文标题:【Android 系统】--- 下载 Android源码超详细 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1728670302a1169074.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论