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 代碼好了。或者剛開始下載的時候,就下載你想要的版本。