国内下载Android源码出错

ubuntu20.4下载Android源码,使用清华的每日更新包,步骤如下:

sudo apt install curl python git git-lfs

解压清华每月更新包

repo forall -c git reset --hard
删除目录 .repo/manifests

使用Github 镜像
repo init -u https://hub.fastgit.org/khadas/android_manifest.git -b khadas-vims-pie

修改default.xml 使用国内镜像源:

victorf@ubuntu:~/khadas/aosp/.repo/manifests$ git diff
diff --git a/default.xml b/default.xml
index 1f50e76b4…f6bf7c8fe 100644
— a/default.xml
+++ b/default.xml
@@ -1,7 +1,7 @@

<?xml version="1.0" encoding="UTF-8"?> - - + +

同步:
export REPO_URL=‘https://mirrors.tuna.tsinghua.edu.cn/git/git-repo

repo sync --force-sync -j4

最后出下面的错误,无法进行下一步repo start:

victorf@ubuntu:~/khadas/aosp$ repo sync -j4

Fetching: 100% (695/695), done in 18.522s

Garbage collecting: 100% (695/695), done in 2.019s

info: A new version of repo is available

warning: repo is not tracking a remote branch, so it will not receive updates

repo reset: error: Entry ‘completion.bash’ not uptodate. Cannot merge.

fatal: Could not reset index file to revision ‘v2.16.4^0’.

问题已经解决,解决办法:

cd .repo/repo

git pull

更新后再次 repo sync -j4