无法使用 Repo 下载 Android 源代码:“无法初始化平台/构建/蓝图的工作树”

无法使用 Repo 下载 Android 源代码:“无法初始化平台/构建/蓝图的工作树”

我正在尝试repo按照以下方式下载 Android 源代码Google 的说明。我已经下载并初始化了 Repo 客户端,现在正在尝试更新工作树。运行后repo sync --force-broken,所有项目似乎都已正确获取,因为控制台输出显示:Fetching projects: 100% (733/733), done.然而,在打印该消息后,Repo 似乎无法同步工作树,并显示以下错误:

Syncing work tree:   0% (2/733) (NOTE: newline inserted here for readability)
error: unable to create file pathtools/testdata/escapes/*: Invalid argument
fatal: cannot create directory at 'pathtools/testdata/escapes/**': Invalid argument
Traceback (most recent call last):
  File "D:\2019 Work\androidsrc\.repo\repo/main.py", line 547, in <module>
    _Main(sys.argv[1:])
  File "D:\2019 Work\androidsrc\.repo\repo/main.py", line 522, in _Main
    result = repo._Run(argv) or 0
  File "D:\2019 Work\androidsrc\.repo\repo/main.py", line 184, in _Run
    result = cmd.Execute(copts, cargs)
  File "D:\2019 Work\androidsrc\.repo\repo\subcmds\sync.py", line 855, in Execute
    project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync)
  File "D:\2019 Work\androidsrc\.repo\repo\project.py", line 1380, in Sync_LocalHalf
    self._InitWorkTree(force_sync=force_sync, submodules=submodules)
  File "D:\2019 Work\androidsrc\.repo\repo\project.py", line 2594, in _InitWorkTree
    raise GitError("cannot initialize work tree for " + self.name)
error.GitError: cannot initialize work tree for platform/build/blueprint

repo --version产量:

repo version v1.13.3
       (from https://gerrit.googlesource.com/git-repo)
repo launcher version 1.25
       (from C:\Program Files\Git\usr\bin\repo)
git version 2.22.0.windows.1
Python 2.7.16 (v2.7.16:413a49145e, Mar  4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)]

答案1

cd 进入 < build-root > (即 bionic/、development/、device/ 等所在的目录) 并尝试:

repo sync --force-sync build/blueprint

如果在多个目录中遇到相同的问题,请尝试:

for subprj in $(repo status | grep ^project | cut -d ' ' -f2); 
do 
    repo sync --force-sync $subprj; 
done

相关内容