博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android 5.1 AOSP 源码获取
阅读量:7104 次
发布时间:2019-06-28

本文共 9923 字,大约阅读时间需要 33 分钟。

本文已同步更新至:

Android 5.1源码开放有一个多月啦,但由于城墙的关系,每次想着更新最新源码学习都万般纠结,现在发现国内有开源镜像啦,这就好多啦,感谢清华开源工作团队的无私工作啊。

地址:

根据页面上的介绍,该镜像只支持源码sync,不支持sdk更新。

  • AOSP 镜像服务单 IP 并发数限制为 4。因版权原因,我们无法提供 Android SDK 镜像

可以看一下他给出的使用帮助

 

本文的步骤如果不成功,请移步上面的帮助链接,因为可能方法有变动。

 

因为我本地已经安装好了repo工具,所以直接根据使用帮助里面介绍的repo init,然后repo sync就可以了。

 

下面介绍一下具体的步骤:

安装repo工具

repo需要安装最新版本的,如果已经像我一样之前有安装的,可以略过此步。

官方给出的repo下载如下:

mkdir ~/binPATH=~/bin:$PATHcurl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repochmod a+x ~/bin/repo

 

repo init

新建存放源码的目录,我这里为 aosp目录,然后cd进入aosp目录,使用repo init目录来初始化仓库。

google官方给出的sync最新源码的命令为:

repo init -u https://android.googlesource.com/platform/manifest

如果不想获取到最新,只想得到某个指定版本,就需要多加一个-b参数,然后跟具体release版本名

repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

可惜国内同样不能用啦,我们要做的就是把-u参数修改为TUNA(清华镜像)的,如下:

repo init -u https://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifest## 如果提示无法连接到 gerrit.googlesource.com,可以编辑 ~/bin/repo,把 REPO_URL 一行替换成下面的:## REPO_URL = 'https://gerrit-google.tuna.tsinghua.edu.cn/git-repo'
 
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-5.1.0_r3

这里再扩展介绍一下 -b参数的获取,android版本号实在是太多啦,不仅andriod 4.0 5.0的,还有小版本r1  r2,怎么才能搞到正确的分支名呢,而且指定的分支名还需要你的更新源上得有的,通过下面的方式:

cd ~git clone git://aosp.tuna.tsinghua.edu.cn/aosp/platform/manifestcd manifestgit branch -a

这样就会列出清华镜像上aosp所有的分支名啦,从中找到你想要的即可

* master  remotes/origin/HEAD -> origin/master  remotes/origin/adt_23.0.3  remotes/origin/android-1.6_r1  remotes/origin/android-1.6_r1.1  remotes/origin/android-1.6_r1.2  remotes/origin/android-1.6_r1.3  remotes/origin/android-1.6_r1.4  remotes/origin/android-1.6_r1.5  remotes/origin/android-1.6_r2  remotes/origin/android-2.0.1_r1  remotes/origin/android-2.0_r1  remotes/origin/android-2.1_r1  remotes/origin/android-2.1_r2  remotes/origin/android-2.1_r2.1p  remotes/origin/android-2.1_r2.1p2  remotes/origin/android-2.1_r2.1s  remotes/origin/android-2.2.1_r1  remotes/origin/android-2.2.1_r2  remotes/origin/android-2.2.2_r1  remotes/origin/android-2.2.3_r1  remotes/origin/android-2.2.3_r2  remotes/origin/android-2.2.3_r2.1  remotes/origin/android-2.2_r1  remotes/origin/android-2.2_r1.1  remotes/origin/android-2.2_r1.2  remotes/origin/android-2.2_r1.3  remotes/origin/android-2.3.1_r1  remotes/origin/android-2.3.2_r1  remotes/origin/android-2.3.3_r1  remotes/origin/android-2.3.3_r1.1  remotes/origin/android-2.3.4_r0.9  remotes/origin/android-2.3.4_r1  remotes/origin/android-2.3.5_r1  remotes/origin/android-2.3.6_r0.9  remotes/origin/android-2.3.6_r1  remotes/origin/android-2.3.7_r1  remotes/origin/android-2.3_r1  remotes/origin/android-4.0.1_r1  remotes/origin/android-4.0.1_r1.1  remotes/origin/android-4.0.1_r1.2  remotes/origin/android-4.0.2_r1  remotes/origin/android-4.0.3_r1  remotes/origin/android-4.0.3_r1.1  remotes/origin/android-4.0.4_r1  remotes/origin/android-4.0.4_r1.1  remotes/origin/android-4.0.4_r1.2  remotes/origin/android-4.0.4_r2  remotes/origin/android-4.0.4_r2.1  remotes/origin/android-4.1.1_r1  remotes/origin/android-4.1.1_r1.1  remotes/origin/android-4.1.1_r2  remotes/origin/android-4.1.1_r3  remotes/origin/android-4.1.1_r4  remotes/origin/android-4.1.1_r5  remotes/origin/android-4.1.1_r6  remotes/origin/android-4.1.1_r6.1  remotes/origin/android-4.1.2_r1  remotes/origin/android-4.1.2_r2  remotes/origin/android-4.1.2_r2.1  remotes/origin/android-4.2.1_r1  remotes/origin/android-4.2.1_r1.1  remotes/origin/android-4.2.1_r1.2  remotes/origin/android-4.2.2_r1  remotes/origin/android-4.2.2_r1.1  remotes/origin/android-4.2.2_r1.2  remotes/origin/android-4.2.2_r1.2b  remotes/origin/android-4.2_r1  remotes/origin/android-4.3.1_r1  remotes/origin/android-4.3_r0.9  remotes/origin/android-4.3_r0.9.1  remotes/origin/android-4.3_r1  remotes/origin/android-4.3_r1.1  remotes/origin/android-4.3_r2  remotes/origin/android-4.3_r2.1  remotes/origin/android-4.3_r2.2  remotes/origin/android-4.3_r2.2-cts  remotes/origin/android-4.3_r2.3  remotes/origin/android-4.3_r3  remotes/origin/android-4.3_r3.1  remotes/origin/android-4.4.1_r1  remotes/origin/android-4.4.1_r1.0.1  remotes/origin/android-4.4.2_r1  remotes/origin/android-4.4.2_r1.0.1  remotes/origin/android-4.4.2_r2  remotes/origin/android-4.4.2_r2.0.1  remotes/origin/android-4.4.3_r1  remotes/origin/android-4.4.3_r1.0.1  remotes/origin/android-4.4.3_r1.1  remotes/origin/android-4.4.3_r1.1.0.1  remotes/origin/android-4.4.4_r1  remotes/origin/android-4.4.4_r1.0.1  remotes/origin/android-4.4.4_r2  remotes/origin/android-4.4.4_r2.0.1  remotes/origin/android-4.4_r1  remotes/origin/android-4.4_r1.0.1  remotes/origin/android-4.4_r1.1  remotes/origin/android-4.4_r1.1.0.1  remotes/origin/android-4.4_r1.2  remotes/origin/android-4.4_r1.2.0.1  remotes/origin/android-4.4w_r1  remotes/origin/android-5.0.0_r1  remotes/origin/android-5.0.0_r1.0.1  remotes/origin/android-5.0.0_r2  remotes/origin/android-5.0.0_r2.0.1  remotes/origin/android-5.0.0_r3  remotes/origin/android-5.0.0_r3.0.1  remotes/origin/android-5.0.0_r4  remotes/origin/android-5.0.0_r4.0.1  remotes/origin/android-5.0.0_r5  remotes/origin/android-5.0.0_r5.0.1  remotes/origin/android-5.0.0_r5.1  remotes/origin/android-5.0.0_r5.1.0.1  remotes/origin/android-5.0.0_r6  remotes/origin/android-5.0.0_r6.0.1  remotes/origin/android-5.0.0_r7  remotes/origin/android-5.0.0_r7.0.1  remotes/origin/android-5.0.1_r1  remotes/origin/android-5.0.2_r1  remotes/origin/android-5.0.2_r3  remotes/origin/android-5.1.0_r1  remotes/origin/android-5.1.0_r3  remotes/origin/android-5.1.0_r4  remotes/origin/android-5.1.0_r5  remotes/origin/android-5.1.1_r1  remotes/origin/android-5.1.1_r2  remotes/origin/android-5.1.1_r3  remotes/origin/android-cts-2.2_r8  remotes/origin/android-cts-2.3_r10  remotes/origin/android-cts-2.3_r11  remotes/origin/android-cts-2.3_r12  remotes/origin/android-cts-4.0.3_r1  remotes/origin/android-cts-4.0.3_r2  remotes/origin/android-cts-4.0_r1  remotes/origin/android-cts-4.1_r1  remotes/origin/android-cts-4.1_r2  remotes/origin/android-cts-4.1_r4  remotes/origin/android-cts-4.2_r2  remotes/origin/android-cts-5.0_r2  remotes/origin/android-cts-5.1_r1  remotes/origin/android-cts-verifier-4.0.3_r1  remotes/origin/android-cts-verifier-4.0_r1  remotes/origin/android-l-preview_r2  remotes/origin/android-sdk-4.0.3-tools_r1  remotes/origin/android-sdk-4.0.3_r1  remotes/origin/android-sdk-4.4.2_r1  remotes/origin/android-sdk-4.4.2_r1.0.1  remotes/origin/android-sdk-adt_r16.0.1  remotes/origin/android-sdk-adt_r20  remotes/origin/android-sdk-support_r11  remotes/origin/android-support-test  remotes/origin/android-tsl-2.0  remotes/origin/android-wear-5.0.0_r1  remotes/origin/chromium-dev  remotes/origin/droiddriver-dev  remotes/origin/froyo  remotes/origin/gingerbread  remotes/origin/gingerbread-release  remotes/origin/gradle-dev  remotes/origin/gradle_0.12.2  remotes/origin/gradle_0.13.0  remotes/origin/gradle_0.13.1  remotes/origin/gradle_0.13.2  remotes/origin/gradle_0.13.3  remotes/origin/gradle_0.14.0  remotes/origin/gradle_0.14.1  remotes/origin/gradle_0.14.2  remotes/origin/gradle_0.14.3  remotes/origin/gradle_0.14.4  remotes/origin/gradle_1.0.0  remotes/origin/gradle_1.0.0-rc1  remotes/origin/gradle_1.0.0-rc2  remotes/origin/gradle_1.0.0-rc3  remotes/origin/gradle_1.0.0-rc4  remotes/origin/gradle_1.0.1  remotes/origin/gradle_1.1.0  remotes/origin/gradle_1.1.0-rc1  remotes/origin/gradle_1.1.0-rc2  remotes/origin/gradle_1.1.0-rc3  remotes/origin/gradle_1.1.1  remotes/origin/gradle_1.1.2  remotes/origin/gradle_1.1.3  remotes/origin/gradle_1.2.0  remotes/origin/gradle_1.2.0-beta1  remotes/origin/gradle_1.2.0-rc1  remotes/origin/gradle_1.2.1  remotes/origin/gradle_1.2.2  remotes/origin/gradle_1.2.3  remotes/origin/ics-mr0  remotes/origin/ics-mr1  remotes/origin/ics-plus-aosp  remotes/origin/idea133  remotes/origin/idea133-weekly-release  remotes/origin/jb-dev  remotes/origin/jb-mr1-dev  remotes/origin/jb-mr1-dev-plus-aosp  remotes/origin/jb-mr1.1-dev  remotes/origin/jb-mr1.1-dev-plus-aosp  remotes/origin/jb-mr2-cts-dev  remotes/origin/jb-mr2-dev  remotes/origin/jumper-stable  remotes/origin/kitkat-cts-dev  remotes/origin/kitkat-dev  remotes/origin/l-preview  remotes/origin/lollipop-cts-dev  remotes/origin/lollipop-dev  remotes/origin/lollipop-mr1-cts-dev  remotes/origin/lollipop-mr1-dev  remotes/origin/master  remotes/origin/master-art  remotes/origin/master-art-host  remotes/origin/master-dalvik  remotes/origin/master-dalvik-host  remotes/origin/master-soong  remotes/origin/ref/for/master  remotes/origin/studio-1.0-dev  remotes/origin/studio-1.0-release  remotes/origin/studio-1.1-dev  remotes/origin/studio-1.1-release  remotes/origin/studio-1.2-dev  remotes/origin/studio-1.2-release  remotes/origin/studio-1.3-dev  remotes/origin/studio-1.3-release  remotes/origin/studio-master-dev  remotes/origin/studio-master-release  remotes/origin/studio_0.8.6  remotes/origin/studio_1.0.0  remotes/origin/studio_1.0.1  remotes/origin/tools-canary-release  remotes/origin/tools_ndk_r9d  remotes/origin/tools_r20  remotes/origin/tools_r21  remotes/origin/tools_r21.1  remotes/origin/tools_r22  remotes/origin/tools_r22.2  remotes/origin/tools_r22.6  remotes/origin/tradefed  remotes/origin/ub-emulator-master  remotes/origin/ub-jack  remotes/origin/ub-jack-arzon  remotes/origin/ub-jack-arzon-mr2  remotes/origin/ub-jack-brest  remotes/origin/ub-jack-lang-dev  remotes/origin/ub-tools-idea133  remotes/origin/ub-tools-idea133-milestone  remotes/origin/ub-tools-idea133-release  remotes/origin/ub-tools-master  remotes/origin/ub-webview-m40-release  remotes/origin/upstream-mirror-lldb  remotes/origin/webview-m40_r1  remotes/origin/webview-m40_r2  remotes/origin/webview-m40_r3  remotes/origin/webview-m40_r4

 

repo sync

repo sync

这样就开始更新代码啦,速度还不错。

 

替换已有的 AOSP 源代码的 remote

如果你之前已经通过某种途径获得了 AOSP 的源码(或者你只是 init 这一步完成后), 你希望以后通过 TUNA 同步 AOSP 部分的代码,只需要将 .repo/manifest.xml 把其中的 aosp 这个 remote 的 fetch 从 https://android.googlesource.com 改为 https://aosp.tuna.tsinghua.edu.cn/

 

转载地址:http://krdhl.baihongyu.com/

你可能感兴趣的文章
hadoop(5)---yarn配置 --常用配置
查看>>
提高博客浏览量的几个小技巧
查看>>
模板Template
查看>>
ios-网络request请求
查看>>
多线程 线程间通信 wait,notify
查看>>
Linux中断(interrupt)子系统之一:中断系统基本原理【转】
查看>>
selenium 页面元素的内置属性
查看>>
ubuntu16.04 离线安装nginx
查看>>
Block、委托、回调函数原理剖析(在Object C语境)——这样讲还不懂,根本不可能!...
查看>>
ubuntu/debian/linux彻底卸载mysql
查看>>
debian彻底清理MYSQL
查看>>
内核编译出错解决
查看>>
SOA会不会造成IT黑洞
查看>>
添加用户到LDAP服务器
查看>>
Application、Session和Cookie
查看>>
查询存储过程所需参数
查看>>
测试调用接口
查看>>
积分不等式
查看>>
几道和三角函数有关的题目
查看>>
文本单词数测试
查看>>