網站首頁 編程語言 正文
一、說明
由于一些原因,利用谷歌的資源下載Android源碼速度很慢,我們可以用清華源里面的資源進行下載。
清華源AOSP配置下載地址詳解:Android 鏡像使用幫助
二、源碼下載示例
由于清華源中給出很清晰的配置下載方法,這兒只做幾條總結:
1. 谷歌鏡象不可用,采用清華源鏡象
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
2. 配置repo
mkdir ~/bin PATH=~/bin:$PATH curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo chmod a+x ~/bin/repo
注意:repo最好加到系統的環境變量中。
3. repo更新
repo的運行過程中會嘗試訪問官方的git源更新自己,如果想使用tuna的鏡像源進行更新,可以將如下內容復制到你的~/.bashrc里
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
并重啟終端模擬器。
4. 下載初始化包
wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
5. 解壓資源包
tar xf aosp-latest.tar
6. 更新指定版本
比如指定下載android-6.0.1_r62,執行以下命令:
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-6.0.1_r62 repo sync
如果遇到"SyntaxError: invalid syntax"等錯誤,如下所示:
? File "/home/jerry/workspace/aosp/.repo/repo/main.py", line 79
? ? file=sys.stderr)
? ? ? ? ^
SyntaxError: invalid syntax
應該是python語法導致的,解決方法如下:
python3 ~/bin/repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-6.0.1_r62 python3 ~/bin/repo sync
7. 快捷腳本
由于網絡及限制網絡并發等原因,repo sync
常常更新失敗,可以用腳本來更新,腳本示例:
repo sync -j4 while [ $? = 1 ]; do echo "==== sync failed, re-sync again ====" sleep 3 repo sync -j4 done
三、注意
1. 遇到同步失敗的問題
比如OMA-DM這個app同步失敗,我們可以修改AOSP目錄下的.repo/manifests/default.xml
來屏蔽掉這個應用的同步,如下圖:
2. 遇到python語法問題
參照如下語法根據實際情況執行repo命令,注意repo要寫上絕對路徑,否則會報錯。
python3 ~/bin/repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-6.0.1_r62 python3 ~/bin/repo sync
原文鏈接:https://blog.csdn.net/Amosstan/article/details/113335459
相關推薦
- 2022-08-21 android實現貝塞爾曲線之波浪效果_Android
- 2022-03-14 1709 - Index column size too large. The maximum co
- 2022-03-29 詳解python的集合set的函數_python
- 2022-04-03 .NET?Core配置連接字符串和獲取數據庫上下文實例_實用技巧
- 2022-05-31 Android調用手機攝像頭的方法_Android
- 2023-10-30 解決docker拉取鏡像時報錯Error response from daemon: Get ““:
- 2022-05-21 C++?Cmake的構建靜態庫和動態庫詳解_C 語言
- 2022-04-09 SpringMVC 使用RestFul風格實現簡單的文件下載
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支