一、查看源碼情況
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