Android源碼環境切換版本

一、查看源碼情況

1、查看當前版本

2、查看可切換的分支

cd .repo/manifests
git branch -a |cut -d / -f 3

部分輸入如下:

......
android-9.0.0_r22
android-9.0.0_r3
android-9.0.0_r30
android-9.0.0_r31
android-9.0.0_r32
android-9.0.0_r33
android-9.0.0_r34
android-9.0.0_r35
android-9.0.0_r36
......

二、選擇切換的版本

android-9.0.0_r3版本爲例,執行以下命令:

repo init -b android-9.0.0_r3
# 本地是最新代碼可以不用同步repo syncrepo start android-9.0.0_r3 --all
# 查看當前的分支   
repo branches

三、錯誤處理

錯誤一

error: in `start android-9.0.0_r3 --all`: [Errno 2] No such file or directory: 
u'/work/android/aosp/device/google/accessory/arduino/.git/HEAD'error: manifest missing or 
unreadable -- please run init

代碼不是最新,輸入repo sync解決

錯誤二

GitError: --force-sync not enabled; cannot overwrite a local work tree. If you're comfortable with the
 possibility of losing the work tree's git metadata, use `repo sync --force-sync device/generic/mini-
 emulator-mips` to proceed.

同步失敗,依次輸入:

repo sync --force-sync device/generic/mini-emulator-mipsrepo sync

參考

問一個:android源代碼,如何切換版本。

發佈了24 篇原創文章 · 獲贊 14 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章