1:下载android主线分支linux
repo init -u https://android.googlesource.com/platform/manifestandroid
2:下载android其它分支git
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1app
3;查看android分支版本号工具
git --git-dir .repo/manifests/.git/ branch -afetch
4:查看android当前版本号ui
在build/core/version_defaults.mk文件中查看PLATFORM_VERSION便可。google
5:切换android分支spa
4.1 初始化repo客户端到某一分支(以android-4.0.3_r1为例)orm
repo init -b android-4.0.3_r1
能够在目录 .repo/manifest.xml中查看repo客户端是在哪一个分支上。
4.1 同步代码
repo sync
6:建立本身的本地分支
6.1 构造本地分支
repo start myandroid4.0.3 --all ,分支名称为myandroid4.0.3
6.2检出到本身建立的分支上
repo checkout myandroid4.0.3 或
repo checkout myandroid4.0.3 origin/android-4.0.3_r1
7:下载android linux kernel代码
查看https://android.googlesource.com/
8:如何得到指定版本的Linux内核
在下载目录下执行:
git checkout remotes/origin/android-2.6.29
(以android-2.6.29为例)
9:查看repo可切换的分支
cd .repo/manifests
git branch -a | cut -d / -f 3
出错问题解决:
1:执行repo sync时出现
fatal: '../platform/abi/cpp.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
error: Cannot fetch platform/abi/cpp
------》在.repo目录下的manifest.xml里找到fetch属性,改为fetch= "git://Android.git.linaro.org/ ",或 "http://android.googlesource.com”。
:
repo工具是git工具的封装,下载单个project时使用git,下载全部android源码时使用repo工具。用法都是同样的。
看着Google的教程,下载了android的源代码。
默认分支是android-4.0.1_r1.
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
代码下载完成了,也编译经过,并在虚拟机中运行了。
最大的问题是:
如何将代码的版本从4.0.1降到2.3.6呢?
网上找一个切换分支的文档,就是不成功。
疑问:是否是切换分支,就能够更改android代码的版本?
文档以下:
查看可切换的分支
cd .repo/manifests
git branch -a | cut -d / -f 3
以 gingerbread-release 分支为例
repo init -b gingerbread-release
repo sync (not needed if your local copy is up to date)
repo start gingerbread-release --all
查看当前的分支
repo branches
在android源代码的根目录下运行这句话:
repo init -b gingerbread-release
-----------------------------博主网上收集---------------------------------------------------------
查看可切换的分支cd .repo/manifestsgit branch -a | cut -d / -f 3以 gingerbread-release 分支为例repo init -b gingerbread-release repo sync (not needed if your local copy is up to date)repo start gingerbread-release --all 查看当前的分支repo branches