Android版本下载以及切换
1:下载android主线分支
repo init -u https://android.googlesource.com/platform/manifest
2:下载android其它分支
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
3;查看android分支版本号
git --git-dir .repo/manifests/.git/ branch -a
4:查看android当前版本号
在build/core/version_defaults.mk文件中查看PLATFORM_VERSION即可。
5:切换android分支
4.1 初始化repo客户端到某一分支(以android-4.0.3_r1为例)
repo init -b android-4.0.3_r1
可以在目录 .repo/manifest.xml中查看repo客户端是在哪个分支上。
4.1 同步代码
reposync
6:创建自己的本地分支
6.1 构造本地分支
repostartmyandroid4.0.3--all,分支名称为myandroid4.0.3
6.2检出到自己创建的分支上
repocheckoutmyandroid4.0.3或
repocheckoutmyandroid4.0.3origin/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'doesnotappeartobeagitrepository
fatal:Theremoteendhungupunexpectedly
error:Cannotfetchplatform/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.
$repoinit-uhttps://android.googlesource.com/platform/manifest-bandroid-4.0.1_r1
代码下载完成了,也编译通过,并在虚拟机中运行了。
最大的问题是:
如何将代码的版本从4.0.1降到2.3.6呢?
网上找一个切换分支的文档,就是不成功。
疑问:是不是切换分支,就可以更改android代码的版本?
文档如下:
查看可切换的分支
cd.repo/manifests
gitbranch-a|cut-d/-f3
以gingerbread-release分支为例
repoinit-bgingerbread-release
reposync(notneededifyourlocalcopyisuptodate)
repostartgingerbread-release--all
查看当前的分支
repobranches
在android源代码的根目录下运行这句话:
repoinit-bgingerbread-release
-----------------------------博主网上收集---------------------------------------------------------
查看可切换的分支
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版本下载以及切换
- android 动态切换主题,动态换肤
- android 查看内存使用情况
- Android横竖屏切换问题
- Android(安卓)系统图标大全
- 】Android横竖屏总结
- Android查看源码
- Android纠正Activity横竖屏切换的生命周期的错误
- 2011.07.04——— android activity切换