(AOSP)repo checkout指定版本

本文详细介绍了如何在Android源代码管理工具repo中切换不同的Android版本分支。通过改变manifest仓库的分支,可以快速更新到所需的Android版本,而无需从头开始初始化整个Android源代码树。文章还分享了在切换过程中可能遇到的常见错误及解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

aosp 怎么切换分支?

To properly switch Android version, all you need to change is branch for your manifest repository. First determine the available branches with manifests for the different Android versions:

cd $ANDROID_ROOT
cd .repo/manifests
git branch -av   # see all available branches on origin
Select a version and

cd $ANDROID_ROOT
repo init -b <my_selected_android_version>
Such selective repo init with -b (without -u) will only update manifest branch and will not otherwise touch your tree.

Now, simply sync it:

repo sync -j8
and some time later, your Android tree will switch to another version.

Speed of this operation is mostly determined by how much default.xml manifest file differs between old and new Android versions - because if some git repository was added in new manifest, it will spend time cloning it. And if some repository was removed, if will actually blow it away.

But, by and large, this method is still much faster than initializing brand new Android tree from scratch.

https://stackoverflow.com/questions/14008113/how-to-switch-android-version-in-local-repo

caoxinyu@caoxinyu-ThinkPad-T470p:/usr/lib/aosp_dir/aosp/.repo/manifests$ python repo init -b android-8.0.0_r9

遇到错误:

  File "/usr/lib/aosp_dir/aosp/.repo/repo/project.py", line 2858, in runner
    (self._project.name, name, p.stderr))
error.GitError: manifests var: 
*** Please tell me who you are.

执行以下命令:

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

fatal: unable to auto-detect email address (got ‘caoxinyu@caoxinyu-ThinkPad-T470p.(none)’)

caoxinyu@caoxinyu-ThinkPad-T470p:/usr/lib/aosp_dir/aosp/.repo/repo$ git config --global user.email "caoxinyu"
caoxinyu@caoxinyu-ThinkPad-T470p:/usr/lib/aosp_dir/aosp/.repo/repo$ git config --global user.email "coaxinyu@gmail.com"
caoxinyu@caoxinyu-ThinkPad-T470p:/usr/lib/aosp_dir/aosp/.repo/repo$ git config --global user.name "caoxinyu"

每次都会提示下面这些,不用管。

caoxinyu@caoxinyu-ThinkPad-T470p:/usr/lib/aosp_dir/aosp/.repo/repo$ python repo init -b android-8.0.0_r9
warning: redirecting to https://aosp.tuna.tsinghua.edu.cn/platform/manifest/

Your identity is: caoxinyu <coaxinyu@gmail.com>
If you want to change this, please re-run 'repo init' with --config-name

repo has been initialized in /usr/lib/aosp_dir/aosp
If this is not the directory in which you want to initialize repo, please run:
   rm -r /usr/lib/aosp_dir/aosp/.repo
and try again.

caoxinyu@caoxinyu-ThinkPad-T470p:/usr/lib/aosp_dir/aosp/.repo/repo$ python repo sync -j8

python repo sync -f
Syncing work tree:  52% (296/568)error: in `sync -f`: revision refs/tags/android-8.0.0_r9 in platform/external/valgrind not found    

syncing work tree:  86% (489/568)error: in `sync -f -j10`: revision refs/tags/android-8.0.0_r36 in platform/prebuilts/clang/host/darwin-x86 not found 
system/bt/embdrv/Android.bp": not found

总结:

不建议这样弄。我尝试了几次,都以失败告终。还是研究最新的android 代码好了。或者刚开始下载的时候,就下载你想要的版本。

转载于:https://www.cnblogs.com/caoxinyu/p/10568468.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值