源碼下載
下載Repo工具
切換在工作目錄中創(chuàng)建bin
文件夾,并將該文件夾添加在PATH
路徑下, 并建議在~/.bashrc
配置文件中添加export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
添加完成后參看下面的命令
mkdir ~/bin
PATH=~/bin:$PATH
cd ~/bin
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod a+x ~/bin/repo
希望使用Google源的同志只需要將curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
替換上面的curl
命令即可
repo是啥
簡單來說repo就是git集合,當(dāng)我們的項(xiàng)目過于龐大使用一個(gè)git管理顯得力不從心的時(shí)候,此時(shí)最簡單明了的解決方式當(dāng)然是使用很多git來組織管理,repo就是在做這個(gè)事情,多提一句,repo使用python腳本語言
初始化repo并下載分支代碼(耗時(shí)操作)
強(qiáng)烈建議各位想要自己嘗試編譯的大佬選擇自己的設(shè)備下載源碼, 不然這個(gè)時(shí)間就浪費(fèi)了
Android版本 | 編譯要求的Ubuntu最低版本 | 編譯要求的JDK版本 |
---|---|---|
Android 6.0 (Marshmallow) - AOSP master | Ubuntu 14.04 | OpenJDK 8 |
Android 5.x (Lollipop) - Android 6.0 (Marshmallow) | Ubuntu 12.04 | OpenJDK 7 |
Android 2.3.x (Gingerbread) - Android 4.4.x (KitKat) | Ubuntu 12.04 | Oracle JDK 6 |
Android 1.5 (Cupcake) - Android 2.3.x (Gingerbread) | Ubuntu 10.04 | Oracle JDK 5 |
Android 4.0.x (Ice Cream Sandwich) 及更低版本需要將make
命令還原到較低版本爬早,以避免出現(xiàn)編譯錯(cuò)誤。
Mac系統(tǒng)要求和更多可見https://source.android.com/source/requirements.html
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-7.0.1-_r14
repo sync
等待...emmm, 建議去喝個(gè)茶, 陪女朋友逛個(gè)街, 睡個(gè)覺啥的...這個(gè)過程比較耗時(shí)尤其是使用Google源的哥們repo init -u https://android.googlesource.com/platform/manifest
由于容易最后的sync
過程由于網(wǎng)絡(luò)原因很容易失敗, 因此小工具如下
#!/bin/sh
repo sync
while [ $? -ne 0 ]
do
repo sync
done
分支切換
查看當(dāng)前分支
repo的版本管理信息存儲在.repo
路徑下, 即查看當(dāng)前分支
cd .repo/manifests
git branch -a
分支切換
- 切換前需要回退已有修改(如果大佬改了源碼的話)
repo forall -c git reset --hard
- 回退完成后可以選擇, 使用初始化命令切換版本
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b android-5.1.1
或checkout
命令切換
repo forall -c git checkout android-5.1.1_r1
- 然后執(zhí)行同步即可, 可別忘了小工具
repo sync
執(zhí)行完成后,如果是使用checkout
切換, 還需要執(zhí)行repo start android-5.1.1_r1 --all
即可
- 免除切換網(wǎng)絡(luò)的繁復(fù)
Source Code Tags and Builds部分摘錄如下
細(xì)分版本 | 分支 | 版本 | 支持的設(shè)備 | |
---|---|---|---|---|
OPR5.170623.007 | android-8.0.0_r17 | Oreo | Nexus 6P | |
OPR4.170623.009 | android-8.0.0_r16 | Oreo | Nexus 5X | |
OPR3.170623.008 | android-8.0.0_r15 | Oreo | Pixel XL、Pixel | |
OPR1.170623.027 | android-8.0.0_r13 | Oreo | Pixel XL、Pixel馅闽、Pixel C | |
OPR6.170623.021 | android-8.0.0_r12 | Oreo | Nexus Player | |
OPR6.170623.019 | android-8.0.0_r11 | Oreo | Nexus 6P | |
OPR4.170623.006 | android-8.0.0_r10 | Oreo | Nexus 5X | |
OPR3.170623.007 | android-8.0.0_r9 | Oreo | Pixel XL左腔、Pixel | |
OPR1.170623.026 | android-8.0.0_r7 | Oreo | Pixel XL矢门、Pixel费变、Pixel C | |
OPR6.170623.013 | android-8.0.0_r4 | Oreo | Nexus 5X、Nexus 6P | |
OPR6.170623.012 | android-8.0.0_r3 | Oreo | Pixel XL漆撞、Pixel | |
OPR6.170623.011 | android-8.0.0_r2 | Oreo | Pixel XL殴泰、Pixel | |
OPR6.170623.010 | android-8.0.0_r1 | Oreo | Pixel C | |
NZH54D | android-7.1.2_r33 | Nougat | Pixel XL、Pixel | |
NKG47S | android-7.1.2_r32 | Nougat | Pixel XL浮驳、Pixel | |
NHG47Q | android-7.1.2_r30 | Nougat | Pixel XL悍汛、Pixel | |
NJH47F | android-7.1.2_r29 | Nougat | Pixel XL、Pixel | |
N2G48C | android-7.1.2_r28 | Nougat | Nexus 5X抹恳、Nexus 6P员凝、Nexus Player、Pixel C | |
NZH54B | android-7.1.2_r27 | Nougat | Pixel XL奋献、Pixel | |
NKG47M | android-7.1.2_r25 | Nougat | Pixel XL健霹、Pixel | |
NJH47D | android-7.1.2_r24 | Nougat | Pixel XL、Pixel | |
NHG47O | android-7.1.2_r23 | Nougat | Pixel XL瓶蚂、Pixel | |
N2G48B | android-7.1.2_r19 | Nougat | Nexus 6P糖埋、Nexus Player、Pixel C | |
N2G47Z | android-7.1.2_r18 | Nougat | Nexus 5X | |
NJH47B | android-7.1.2_r17 | Nougat | Pixel XL窃这、Pixel | |
NJH34C | android-7.1.2_r16 | Nougat | Pixel XL瞳别、Pixel | |
NKG47L | android-7.1.2_r15 | Nougat | Pixel XL、Pixel | |
NHG47N | android-7.1.2_r14 | Nougat | Pixel XL杭攻、Pixel | |
N2G47X | android-7.1.2_r13 | Nougat | Nexus Player | |
N2G47W | android-7.1.2_r12 | Nougat | Nexus 5X祟敛、Nexus 6P、Pixel C | |
NHG47L | android-7.1.2_r11 | Nougat | Pixel XL兆解、Pixel | |
N2G47T | android-7.1.2_r10 | Nougat | Pixel XL馆铁、Pixel | |
N2G47R | android-7.1.2_r9 | Nougat | Nexus Player | |
N2G47O | android-7.1.2_r8 | Nougat | Nexus 5X、Nexus 6P锅睛、Pixel XL埠巨、Pixel历谍、Pixel C | |
NHG47K | android-7.1.2_r6 | Nougat | Pixel XL、Pixel | |
N2G47J | android-7.1.2_r5 | Nougat | Pixel XL辣垒、Pixel | |
N2G47H | android-7.1.2_r4 | Nougat | Nexus 6P望侈、Nexus Player | |
N2G47F | android-7.1.2_r3 | Nougat | Nexus 5X | |
N2G47E | android-7.1.2_r2 | Nougat | Pixel XL、Pixel | |
N2G47D | android-7.1.2_r1 | Nougat | Pixel C | |
N9F27M | android-7.1.1_r58 | Nougat | Nexus 9 (volantis) | |
NGI77B | android-7.1.1_r57 | Nougat | Nexus 6 | |
N6F27M | android-7.1.1_r55 | Nougat | Nexus 6 | |
N4F27P | android-7.1.1_r54 | Nougat | Nexus 9 (volantisg) | |
N9F27L | android-7.1.1_r53 | Nougat | Nexus 9 | |
NGI55D | android-7.1.1_r52 | Nougat | Nexus 6 | |
N4F27O | android-7.1.1_r51 | Nougat | Nexus 9 (volantisg) | |
N8I11B | android-7.1.1_r50 | Nougat | Nexus 6 | |
N9F27H | android-7.1.1_r49 | Nougat | Nexus 9 (volantis) | |
N6F27I | android-7.1.1_r48 | Nougat | Nexus 6 | |
N4F27K | android-7.1.1_r47 | Nougat | Nexus 9 (volantisg) | |
N9F27F | android-7.1.1_r46 | Nougat | Nexus 9 (volantis) | |
N6F27H | android-7.1.1_r45 | Nougat | Nexus 6 | |
N4F27I | android-7.1.1_r44 | Nougat | Nexus 9 (volantisg) | |
N9F27C | android-7.1.1_r43 | Nougat | Nexus 9 (volantis) | |
N6F27E | android-7.1.1_r42 | Nougat | Nexus 6 | |
N4F27E | android-7.1.1_r41 | Nougat | Nexus 9 (volantisg) | |
N6F27C | android-7.1.1_r40 | Nougat | Nexus 6 | |
N4F27B | android-7.1.1_r39 | Nougat | Nexus 9 (volantis/volantisg) | |
N6F26Y | android-7.1.1_r38 | Nougat | Nexus 6 | |
NOF27D | android-7.1.1_r35 | Nougat | Pixel XL勋桶、Pixel | |
N4F26X | android-7.1.1_r33 | Nougat | Nexus 9 (volantis/volantisg) | |
N4F26U | android-7.1.1_r31 | Nougat | Nexus 5X脱衙、Nexus 6P | |
N6F26U | android-7.1.1_r28 | Nougat | Nexus 6 | |
NUF26N | android-7.1.1_r27 | Nougat | Nexus 6P | |
NOF27C | android-7.1.1_r26 | Nougat | Pixel XL、Pixel | |
NOF27B | android-7.1.1_r25 | Nougat | Pixel XL哥遮、Pixel | |
N4F26T | android-7.1.1_r24 | Nougat | Nexus 5X岂丘、Nexus 6P陵究、Nexus 9 (volantis/volantisg)眠饮、Pixel C | |
NMF27D | android-7.1.1_r23 | Nougat | Nexus Player | |
NMF26X | android-7.1.1_r22 | Nougat | Nexus Player | |
NOF26W | android-7.1.1_r21 | Nougat | Pixel XL、Pixel | |
NOF26V | android-7.1.1_r20 | Nougat | Pixel XL铜邮、Pixel | |
N6F26R | android-7.1.1_r17 | Nougat | Nexus 6 | |
NUF26K | android-7.1.1_r16 | Nougat | Nexus 6P | |
N4F26Q | android-7.1.1_r15 | Nougat | Nexus 9 (volantis/volantisg) | |
N4F26O | android-7.1.1_r14 | Nougat | Nexus 5X仪召、Nexus 6P、Pixel C | |
N6F26Q | android-7.1.1_r13 | Nougat | Nexus 6 | |
N4F26M | android-7.1.1_r12 | Nougat | Nexus 9 (volantis) | |
N4F26J | android-7.1.1_r11 | Nougat | Nexus 5X松蒜、Nexus 6P | |
N4F26I | android-7.1.1_r10 | Nougat | Nexus 5X攻走、Nexus 6P物喷、Pixel C | |
NMF26V | android-7.1.1_r9 | Nougat | Pixel XL、Pixel | |
NMF26U | android-7.1.1_r8 | Nougat | Pixel XL、Pixel | |
NMF26R | android-7.1.1_r7 | Nougat | Nexus Player | |
NMF26Q | android-7.1.1_r6 | Nougat | Pixel XL加袋、Pixel | |
NMF26O | android-7.1.1_r4 | Nougat | Pixel XL、Pixel | |
NMF26J | android-7.1.1_r3 | Nougat | Nexus Player | |
NMF26H | android-7.1.1_r2 | Nougat | Pixel C | |
NMF26F | android-7.1.1_r1 | Nougat | Nexus 5X捻艳、Nexus 6P杰捂、Nexus 9 (volantis/volantisg) | |
NDE63X | android-7.1.0_r7 | Nougat | Pixel XL、Pixel | |
NDE63V | android-7.1.0_r6 | Nougat | Pixel XL檀咙、Pixel | |
NDE63U | android-7.1.0_r5 | Nougat | Pixel XL雅倒、Pixel | |
NDE63P | android-7.1.0_r4 | Nougat | Pixel XL、Pixel | |
NDE63L | android-7.1.0_r2 | Nougat | Pixel XL弧可、Pixel | |
NDE63H | android-7.1.0_r1 | Nougat | Pixel XL、Pixel | |
NBD92G | android-7.0.0_r33 | Nougat | Nexus 6 | |
NBD92F | android-7.0.0_r32 | Nougat | Nexus 6 | |
NBD92E | android-7.0.0_r31 | Nougat | Nexus 6 | |
NBD92D | android-7.0.0_r30 | Nougat | Nexus 6 | |
NBD91Z | android-7.0.0_r29 | Nougat | Nexus 6 | |
NBD91Y | android-7.0.0_r28 | Nougat | Nexus 6 | |
NBD91X | android-7.0.0_r27 | Nougat | Nexus 6 | |
NBD91U | android-7.0.0_r24 | Nougat | Nexus 6 | |
N5D91L | android-7.0.0_r21 | Nougat | Nexus 5X | |
NBD91P | android-7.0.0_r19 | Nougat | Nexus 6 | |
NRD91K | android-7.0.0_r17 | Nougat | Nexus 6P | |
NRD91N | android-7.0.0_r15 | Nougat | Nexus 5X棕诵、Pixel C裁良、Nexus Player、Nexus 9 (volantis/volantisg) | |
NBD90Z | android-7.0.0_r14 | Nougat | Nexus 6 | |
NBD90X | android-7.0.0_r13 | Nougat | Nexus 6P | |
NBD90W | android-7.0.0_r12 | Nougat | Nexus 5X | |
NRD91D | android-7.0.0_r7 | Nougat | Pixel C校套、Nexus Player价脾、Nexus 9 (WLAN) | |
NRD90U | android-7.0.0_r6 | Nougat | Nexus 6P | |
NRD90T | android-7.0.0_r5 | Nougat | Nexus 6P | |
NRD90S | android-7.0.0_r4 | Nougat | Nexus 5X | |
NRD90R | android-7.0.0_r3 | Nougat | Nexus 5X、Nexus 9 (volantis)搔确、Nexus Player彼棍、Pixel C | |
NRD90M | android-7.0.0_r1 | Nougat | Nexus 5X灭忠、Nexus 9 (volantis)、Nexus Player座硕、Pixel C | |
MOB31Z | android-6.0.1_r80 | Marshmallow | ||
MOB31T | android-6.0.1_r79 | Marshmallow | Nexus 6 | |
MOB31S | android-6.0.1_r78 | Marshmallow | Nexus 6 | |
M4B30Z | android-6.0.1_r77 | Marshmallow | Nexus 5 | |
MOB31K | android-6.0.1_r74 | Marshmallow | Nexus 6 | |
MMB31C | android-6.0.1_r73 | Marshmallow | Nexus 6 | |
M4B30X | android-6.0.1_r72 | Marshmallow | Nexus 5 | |
MOB31H | android-6.0.1_r70 | Marshmallow | Nexus 6 | |
MMB30Y | android-6.0.1_r69 | Marshmallow | Nexus 6 | |
MTC20K | android-6.0.1_r67 | Marshmallow | Nexus 5X | |
MOB31E | android-6.0.1_r66 | Marshmallow | Nexus 5弛作、Nexus 6、Nexus 9 (volantis) | |
MMB30W | android-6.0.1_r65 | Marshmallow | Nexus 6 | |
MXC89L | android-6.0.1_r63 | Marshmallow | Pixel C | |
MTC20F | android-6.0.1_r62 | Marshmallow | Nexus 5X华匾、Nexus 6P | |
MOB30Y | android-6.0.1_r60 | Marshmallow | Nexus 5 | |
MOB30X | android-6.0.1_r59 | Marshmallow | Nexus 7 (flo/deb) | |
MOB30W | android-6.0.1_r58 | Marshmallow | Nexus 6映琳、Nexus 9 (volantis/volantisg)、Nexus Player | |
MMB30S | android-6.0.1_r57 | Marshmallow | Nexus 7 (deb) | |
MMB30R | android-6.0.1_r56 | Marshmallow | Nexus 6 | |
MXC89K | android-6.0.1_r55 | Marshmallow | Pixel C | |
MTC19Z | android-6.0.1_r54 | Marshmallow | Nexus 5X | |
MTC19X | android-6.0.1_r53 | Marshmallow | Nexus 6P | |
MOB30P | android-6.0.1_r50 | Marshmallow | Nexus 5蜘拉、Nexus 7 (flo/deb)萨西、Nexus 9 (volantis/volantisg)、Nexus Player | |
MOB30O | android-6.0.1_r49 | Marshmallow | Nexus 6 | |
MMB30M | android-6.0.1_r48 | Marshmallow | Nexus 7 (deb) | |
MMB30K | android-6.0.1_r47 | Marshmallow | Nexus 6 | |
MOB30M | android-6.0.1_r46 | Marshmallow | Nexus 5旭旭、Nexus 6谎脯、Nexus 7 (flo/deb)、Nexus 9 (volantis/volantisg)持寄、Nexus Player | |
MTC19V | android-6.0.1_r45 | Marshmallow | Nexus 5X源梭、Nexus 6P | |
MOB30J | android-6.0.1_r43 | Marshmallow | Nexus 7 (flo/deb) | |
MOB30I | android-6.0.1_r42 | Marshmallow | Nexus 6 | |
MOB30H | android-6.0.1_r41 | Marshmallow | Nexus 5 | |
MOB30G | android-6.0.1_r40 | Marshmallow | Nexus 9 (volantis/volantisg)、Nexus Player | |
MXC89H | android-6.0.1_r33 | Marshmallow | Pixel C | |
MXC89F | android-6.0.1_r32 | Marshmallow | Pixel C | |
MMB30J | android-6.0.1_r28 | Marshmallow | Nexus 6稍味、Nexus 7 (deb) | |
MTC19T | android-6.0.1_r25 | Marshmallow | Nexus 5X废麻、Nexus 6P | |
M5C14J | android-6.0.1_r31 | Marshmallow | Pixel C | |
MOB30D | android-6.0.1_r30 | Marshmallow | Nexus 5、Nexus 6模庐、Nexus 7 (flo/deb)烛愧、Nexus 9 (volantis/volantisg)、Nexus Player | |
MHC19Q | android-6.0.1_r24 | Marshmallow | Nexus 5X掂碱、Nexus 6P | |
MHC19J | android-6.0.1_r22 | Marshmallow | Nexus 5X | |
MHC19I | android-6.0.1_r21 | Marshmallow | Nexus 6P | |
MMB29X | android-6.0.1_r20 | Marshmallow | Nexus 5怜姿、Nexus 6、Nexus 7 (deb)顶吮、Nexus 9 (volantisg) | |
MXC14G | android-6.0.1_r18 | Marshmallow | Pixel C | |
MMB29V | android-6.0.1_r17 | Marshmallow | Nexus 5社牲、Nexus 5X、Nexus 6悴了、Nexus 6P搏恤、Nexus 7 (flo/deb)、Nexus 9 (volantis/volantisg) | |
MXB48T | android-6.0.1_r16 | Marshmallow | Pixel C | |
MMB29U | android-6.0.1_r13 | Marshmallow | Nexus Player | |
MMB29R | android-6.0.1_r12 | Marshmallow | Nexus 9 (volantis/volantisg) | |
MMB29Q | android-6.0.1_r11 | Marshmallow | Nexus 5湃交、Nexus 5X熟空、Nexus 6、Nexus 6P搞莺、Nexus 7 (flo/deb) | |
MMB29T | android-6.0.1_r10 | Marshmallow | Nexus Player | |
MMB29S | android-6.0.1_r9 | Marshmallow | Nexus 5息罗、Nexus 6、Nexus 9 (volantis/volantisg) | |
MMB29P | android-6.0.1_r8 | Marshmallow | Nexus 5X才沧、Nexus 6P | |
MMB29O | android-6.0.1_r7 | Marshmallow | Nexus 7 (flo/deb) | |
MXB48K | android-6.0.1_r5 | Marshmallow | Pixel C | |
MXB48J | android-6.0.1_r4 | Marshmallow | Pixel C | |
MMB29M | android-6.0.1_r3 | Marshmallow | Nexus 6P迈喉、Nexus Player | |
MMB29K | android-6.0.1_r1 | Marshmallow | Nexus 5绍刮、Nexus 5X、Nexus 6挨摸、Nexus 7 (flo/deb)孩革、Nexus 9 (volantis/volantisg) | |
MMB29N | android-6.0.0_r41 | Marshmallow | Nexus 6P | |
MDB08M | android-6.0.0_r26 | Marshmallow | Nexus 5X、Nexus 6P | |
MDB08L | android-6.0.0_r25 | Marshmallow | Nexus 5X得运、Nexus 6P | |
MDB08K | android-6.0.0_r24 | Marshmallow | Nexus 6P | |
MDB08I | android-6.0.0_r23 | Marshmallow | Nexus 5X | |
MDA89E | android-6.0.0_r12 | Marshmallow | Nexus 5X | |
MDA89D | android-6.0.0_r11 | Marshmallow | Nexus 6P | |
MRA59B | android-6.0.0_r7 | Marshmallow | Nexus 7 (deb) | |
MRA58X | android-6.0.0_r6 | Marshmallow | Nexus 6 | |
MRA58V | android-6.0.0_r5 | Marshmallow | Nexus 7 (flo/deb) | |
MRA58U | android-6.0.0_r4 | Marshmallow | Nexus 7 (flo) | |
MRA58N | android-6.0.0_r2 | Marshmallow | Nexus 5膝蜈、Nexus 6、Nexus 7 (flo/deb)熔掺、Nexus 9 (volantis/volantisg)饱搏、Nexus Player | |
MRA58K | android-6.0.0_r1 | Marshmallow | Nexus 5、Nexus 6置逻、Nexus 7 (flo/deb)推沸、Nexus 9 (volantis/volantisg)、Nexus Player | |
LMY49M | android-5.1.1_r38 | Lollipop | Nexus 10 | |
LMY49J | android-5.1.1_r37 | Lollipop | Nexus 10 | |
LMY49I | android-5.1.1_r36 | Lollipop | Nexus 10 | |
LMY49H | android-5.1.1_r35 | Lollipop | Nexus 10 | |
LMY49G | android-5.1.1_r34 | Lollipop | Nexus 10 | |
LMY49F | android-5.1.1_r33 | Lollipop | Nexus 9 (volantisg)诽偷、Nexus 10 | |
LMY48Z | android-5.1.1_r30 | Lollipop | Nexus 6坤学、Nexus 7 (deb)、Nexus 9 (volantisg)报慕、Nexus 10 | |
LYZ28N | android-5.1.1_r28 | Lollipop | Nexus 6(僅面向 T-Mobile) | |
LMY48Y | android-5.1.1_r26 | Lollipop | Nexus 6 | |
LMY48X | android-5.1.1_r25 | Lollipop | Nexus 6、Nexus 7 (deb)压怠、Nexus 9 (volantisg)眠冈、Nexus 10 | |
LMY48W | android-5.1.1_r24 | Lollipop | Nexus 6 | |
LVY48H | android-5.1.1_r23 | Lollipop | Nexus 6(僅面向 Project Fi) | |
LYZ28M | android-5.1.1_r22 | Lollipop | Nexus 6(僅面向 T-Mobile) | |
LMY48U | android-5.1.1_r20 | Lollipop | Nexus 7 (deb) | |
LMY48T | android-5.1.1_r19 | Lollipop | Nexus 4、Nexus 6菌瘫、Nexus 9 (volantis/volantisg)蜗顽、Nexus 10 | |
LVY48F | android-5.1.1_r18 | Lollipop | Nexus 6(僅面向 Project Fi) | |
LYZ28K | android-5.1.1_r17 | Lollipop | Nexus 6(僅面向 T-Mobile) | |
LMY48P | android-5.1.1_r16 | Lollipop | Nexus 7 (deb) | |
LMY48N | android-5.1.1_r15 | Lollipop | Nexus Player | |
LMY48M | android-5.1.1_r14 | Lollipop | Nexus 4、Nexus 5雨让、Nexus 6雇盖、Nexus 7 (flo)、Nexus 9 (volantis/volantisg)栖忠、Nexus 10 | |
LVY48E | android-5.1.1_r13 | Lollipop | Nexus 6(僅面向 Project Fi) | |
LYZ28J | android-5.1.1_r12 | Lollipop | Nexus 6(僅面向 T-Mobile) | |
LMY48J | android-5.1.1_r10 | Lollipop | Nexus Player | |
LMY48I | android-5.1.1_r9 | Lollipop | Nexus 4崔挖、Nexus 5、Nexus 6庵寞、Nexus 7 (flo)狸相、Nexus 9 (volantis/volantisg)、Nexus 10 | |
LVY48C | android-5.1.1_r8 | Lollipop | Nexus 6(僅面向 Project Fi) | |
LMY48G | android-5.1.1_r6 | Lollipop | Nexus 7 (flo) | |
LYZ28E | android-5.1.1_r5 | Lollipop | Nexus 6(僅面向 T-Mobile) | |
LMY47Z | android-5.1.1_r4 | Lollipop | Nexus 6(面向除 T-Mobile(美國)之外的所有運(yùn)營商) | |
LMY48B | android-5.1.1_r3 | Lollipop | Nexus 5 | |
LMY47X | android-5.1.1_r2 | Lollipop | Nexus 9 (volantis) | |
LMY47V | android-5.1.1_r1 | Lollipop | Nexus 7 (flo/grouper)捐川、Nexus 10脓鹃、Nexus Player | |
LMY47O | android-5.1.0_r5 | Lollipop | Nexus 4、Nexus 7 (flo/deb) | |
LMY47M | android-5.1.0_r4 | Lollipop | Nexus 6(僅面向 T-Mobile) | |
LMY47I | android-5.1.0_r3 | Lollipop | Nexus 5古沥、Nexus 6 | |
LMY47E | android-5.1.0_r2 | Lollipop | Nexus 6 | |
LMY47D | android-5.1.0_r1 | Lollipop | Nexus 5瘸右、Nexus 6娇跟、Nexus 7 (grouper/tilapia)、Nexus 10太颤、Nexus Player | |
LRX22L | android-5.0.2_r3 | Lollipop | Nexus 9 (volantis/volantisg) | |
LRX22G | android-5.0.2_r1 | Lollipop | Nexus 7 (flo/deb/grouper/tilapia)逞频、Nexus 10 | |
LRX22C | android-5.0.1_r1 | Lollipop | Nexus 4、Nexus 5栋齿、Nexus 6 (shamu)苗胀、Nexus 7 (flo)、Nexus 9 (volantis/volantisg)瓦堵、Nexus 10 | |
LRX21V | android-5.0.0_r7.0.1 | Lollipop | Nexus Player (fugu) | |
LRX21T | android-5.0.0_r6.0.1 | Lollipop | Nexus 4 | |
LRX21R | android-5.0.0_r5.1.0.1 | Lollipop | Nexus 9 (volantis) | |
LRX21Q | android-5.0.0_r5.0.1 | Lollipop | Nexus 9 (volantis) | |
LRX21P | android-5.0.0_r4.0.1 | Lollipop | Nexus 7 (flo/grouper)基协、Nexus 10 | |
LRX21O | android-5.0.0_r3.0.1 | Lollipop | Nexus 5 (hammerhead)、Nexus 6 (shamu) | |
LRX21M | android-5.0.0_r2.0.1 | Lollipop | Nexus Player (fugu) | |
LRX21L | android-5.0.0_r1.0.1 | Lollipop | Nexus 9 (volantis) | |
KTU84Q | android-4.4.4_r2 | KitKat | Nexus 5 (hammerhead)(僅面向新西蘭的 2Degrees菇用、澳大利亞的 Telstra 和印度) | |
KTU84P | android-4.4.4_r1 | KitKat | Nexus 5澜驮、Nexus 7 (flo/deb/grouper/tilapia)、Nexus 4惋鸥、Nexus 10 | |
KTU84M | android-4.4.3_r1.1 | KitKat | Nexus 5 (hammerhead) | |
KTU84L | android-4.4.3_r1 | KitKat | Nexus 7 (flo/deb/grouper/tilapia)杂穷、Nexus 4、Nexus 10 | |
KVT49L | android-4.4.2_r2 | KitKat | Nexus 7 (deb Verizon) | |
KOT49H | android-4.4.2_r1 | KitKat | Nexus 5卦绣、Nexus 7 (flo/deb/grouper/tilapia)耐量、Nexus 4、Nexus 10 | |
KOT49E | android-4.4.1_r1 | KitKat | Nexus 5滤港、Nexus 7 (flo/deb/grouper/tilapia)廊蜒、Nexus 4、Nexus 10 | |
KRT16S | android-4.4_r1.2 | KitKat | Nexus 7 (flo/deb/grouper/tilapia)溅漾、Nexus 4山叮、Nexus 10 | |
KRT16M | android-4.4_r1 | KitKat | Nexus 5 (hammerhead) | |
JLS36I | android-4.3.1_r1 | Jelly Bean | Nexus 7 (deb) | |
JLS36C | android-4.3_r3 | Jelly Bean | Nexus 7 (deb) | |
JSS15R | android-4.3_r2.3 | Jelly Bean | Nexus 7 (flo) | |
JSS15Q | android-4.3_r2.2 | Jelly Bean | Nexus 7 (flo) | |
JSS15J | android-4.3_r2.1 | Jelly Bean | Nexus 7 (flo/deb) | |
JSR78D | android-4.3_r2 | Jelly Bean | Nexus 7 (deb) | |
JWR66Y | android-4.3_r1.1 | Jelly Bean | Galaxy Nexus、Nexus 7 (grouper/tilapia)添履、Nexus 4屁倔、Nexus 10 | |
JWR66V | android-4.3_r1 | Jelly Bean | Galaxy Nexus、Nexus 7 (grouper/tilapia)暮胧、Nexus 4锐借、Nexus 10 | |
JWR66N | android-4.3_r0.9.1 | Jelly Bean | Galaxy Nexus、Nexus 7 (grouper/tilapia/flo)叔壤、Nexus 4瞎饲、Nexus 10 | |
JWR66L | android-4.3_r0.9 | Jelly Bean | Nexus 7 | |
JDQ39E | android-4.2.2_r1.2 | Jelly Bean | Nexus 4 | |
JDQ39B | android-4.2.2_r1.1 | Jelly Bean | Nexus 7 | |
JDQ39 | android-4.2.2_r1 | Jelly Bean | Galaxy Nexus、Nexus 7炼绘、Nexus 4嗅战、Nexus 10 | |
JOP40G | android-4.2.1_r1.2 | Jelly Bean | Nexus 4 | |
JOP40F | android-4.2.1_r1.1 | Jelly Bean | Nexus 10 | |
JOP40D | android-4.2.1_r1 | Jelly Bean | Galaxy Nexus、Nexus 7、Nexus 4驮捍、Nexus 10 | |
JOP40C | android-4.2_r1 | Jelly Bean | Galaxy Nexus疟呐、Nexus 7、Nexus 4东且、Nexus 10 | |
JZO54M | android-4.1.2_r2.1 | Jelly Bean | ||
JZO54L | android-4.1.2_r2 | Jelly Bean | ||
JZO54K | android-4.1.2_r1 | Jelly Bean | Nexus S启具、Galaxy Nexus、Nexus 7 | |
JRO03S | android-4.1.1_r6.1 | Jelly Bean | Nexus 7 | |
JRO03R | android-4.1.1_r6 | Jelly Bean | Nexus S 4G | |
JRO03O | android-4.1.1_r5 | Jelly Bean | Galaxy Nexus | |
JRO03L | android-4.1.1_r4 | Jelly Bean | Nexus S | |
JRO03H | android-4.1.1_r3 | Jelly Bean | ||
JRO03E | android-4.1.1_r2 | Jelly Bean | Nexus S | |
JRO03D | android-4.1.1_r1.1 | Jelly Bean | Nexus 7 | |
JRO03C | android-4.1.1_r1 | Jelly Bean | Galaxy Nexus | |
IMM76L | android-4.0.4_r2.1 | Ice Cream Sandwich | ||
IMM76K | android-4.0.4_r2 | Ice Cream Sandwich | Galaxy Nexus | |
IMM76I | android-4.0.4_r1.2 | Ice Cream Sandwich | Galaxy Nexus | |
IMM76D | android-4.0.4_r1.1 | Ice Cream Sandwich | Nexus S珊泳、Nexus S 4G鲁冯、Galaxy Nexus | |
IMM76 | android-4.0.4_r1 | Ice Cream Sandwich | ||
IML77 | android-4.0.3_r1.1 | Ice Cream Sandwich | ||
IML74K | android-4.0.3_r1 | Ice Cream Sandwich | Nexus S | |
ICL53F | android-4.0.2_r1 | Ice Cream Sandwich | Galaxy Nexus | |
ITL41F | android-4.0.1_r1.2 | Ice Cream Sandwich | Galaxy Nexus | |
ITL41D | android-4.0.1_r1.1 | Ice Cream Sandwich | Galaxy Nexus | |
ITL41D | android-4.0.1_r1 | Ice Cream Sandwich | Galaxy Nexus | |
GWK74 | android-2.3.7_r1 | Gingerbread | Nexus S 4G | |
GRK39F | android-2.3.6_r1 | Gingerbread | Nexus One、Nexus S | |
GRK39C | android-2.3.6_r0.9 | Gingerbread | Nexus S | |
GRJ90 | android-2.3.5_r1 | Gingerbread | Nexus S 4G | |
GRJ22 | android-2.3.4_r1 | Gingerbread | Nexus One色查、Nexus S薯演、Nexus S 4G | |
GRJ06D | android-2.3.4_r0.9 | Gingerbread | Nexus S 4G | |
GRI54 | android-2.3.3_r1.1 | Gingerbread | Nexus S | |
GRI40 | android-2.3.3_r1 | Gingerbread | Nexus One、Nexus S | |
GRH78C | android-2.3.2_r1 | Gingerbread | Nexus S | |
GRH78 | android-2.3.1_r1 | Gingerbread | Nexus S | |
GRH55 | android-2.3_r1 | Gingerbread | 使用 Gingerbread 最早期版本的設(shè)備秧了、Nexus S | |
FRK76C | android-2.2.3_r2 | Froyo | ||
FRK76 | android-2.2.3_r1 | Froyo | ||
FRG83G | android-2.2.2_r1 | Froyo | Nexus One | |
FRG83D | android-2.2.1_r2 | Froyo | Nexus One | |
FRG83 | android-2.2.1_r1 | Froyo | Nexus One | |
FRG22D | android-2.2_r1.3 | Froyo | ||
FRG01B | android-2.2_r1.2 | Froyo | ||
FRF91 | android-2.2_r1.1 | Froyo | Nexus One | |
FRF85B | android-2.2_r1 | Froyo | Nexus One | |
EPF21B | android-2.1_r2.1p2 | Eclair | ||
ESE81 | android-2.1_r2.1s | Eclair | ||
EPE54B | android-2.1_r2.1p | Eclair | Nexus One | |
ERE27 | android-2.1_r2 | Eclair | Nexus One | |
ERD79 | android-2.1_r1 | Eclair | Nexus One | |
ESD56 | android-2.0.1_r1 | Eclair | ||
ESD20 | android-2.0_r1 | Eclair | ||
DMD64 | android-1.6_r1.5 | Donut | ||
DRD20 | android-1.6_r1.4 | |||
DRD08 | android-1.6_r1.3 | |||
DRC92 | android-1.6_r1.2 |
表格生成小工具: http://www.tablesgenerator.com/markdown_tables
替換當(dāng)前已有的源碼的遠(yuǎn)程倉庫
需要修改兩個(gè)文件
-
.repo/manifest.xml
文件remote name="aosp"
標(biāo)簽下的fetch
路徑
<manifest>
<remote name="aosp"
- fetch="https://android.googlesource.com"
+ fetch="https://aosp.tuna.tsinghua.edu.cn"
review="android-review.googlesource.com" />
<remote name="github"
-
.repo/manifests.git/config
文件中的url
- url = https://android.googlesource.com/platform/manifest
+ url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest
編譯源碼
編譯環(huán)境配置
官方配置流程https://source.android.com/source/initializing.html
注: Android 4.0的代碼只能使用jdk版本JDK_SE1.6, Make版本3.81,并強(qiáng)烈推薦使用Linux系統(tǒng)編譯而不是Mac或Windows, 本文使用Ubuntu 18.04
圖省事的大佬,請看下面一步到位的呵護(hù)
sudo apt-get update
sudo apt-get install -y git gnupg flex bison m4 gperf build-essential
sudo apt-get install -y zip unzip curl gcc-multilib g++-multilib libgl1-mesa-dev
sudo apt-get install -y tofrodos libxml2-utils xsltproc dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install -y libx11-dev:i386 libreadline6-dev:i386 libc6-dev-i386 libncurses5-dev:i386 zlib1g-dev zlib1g-dev:i386 lib32ncurses5-dev lib32z-dev ccache x11proto-core-dev libx11-dev
make命令安裝
下載需要的make版本源碼: ftp://ftp.gnu.org/gnu/make/
tar -zxvf make-3.81.tar.gz
cd make-3.81/
./configure
make
執(zhí)行到這里的時(shí)候如果遇到錯(cuò)誤了,比如像這個(gè)亞子的
/make-3.81/glob/glob.c:575: undefined reference to `__alloca'
glob/libglob.a(glob.o):/home/ziv/Desktop/make-3.81/glob/glob.c:726: more undefined references to `__alloca' follow
不要慌, 找到make-3.81/glob/glob.c
這個(gè)文件, 找到這句話#if !defined __alloca && !defined __GNU_LIBRARY__
, 去掉defined __GNU_LIBRARY__
前的感嘆號
if !defined __alloca && defined __GNU_LIBRARY__
保存退出,重新執(zhí)行make
make
sudo make install
當(dāng)當(dāng)當(dāng)當(dāng), 安裝成功...
openjdk安裝
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternative --config java
安裝完成, 切換完java版本后一定要記得重新開一個(gè)終端,執(zhí)行一下java -version
看看是不是切換成功了
正式編譯(耗時(shí)操作)
source build/envsetup.sh
lunch aosp_arm-eng
make
是的你沒有看錯(cuò),只要你配好了環(huán)境,編譯就是這么簡單,
需要注意的是lunch
命令不帶參數(shù)輸入后,可以選擇你想要編譯的編譯目標(biāo)格式
所有編譯目標(biāo)都采用 BUILD-BUILDTYPE 形式跨扮,其中 BUILD 是表示特定功能組合的代號。BUILDTYPE 是以下類型之一
編譯類型 | 使用情況 |
---|---|
user | 權(quán)限受限验毡;適用于生產(chǎn)環(huán)境 |
userdebug | 與“user”類似衡创,但具有 root 權(quán)限和調(diào)試功能;是進(jìn)行調(diào)試時(shí)的首選編譯類型 |
eng | 具有額外調(diào)試工具的開發(fā)配置 |
滄海桑田, 歷經(jīng)無數(shù)個(gè)歲月, 終于成功了...
### make completed successfully (01:18:45(hh:mm:ss)) ###
模擬器運(yùn)行
source build/envsetup.sh
lunch(選擇剛才你設(shè)置的目標(biāo)版本,比如這里了我選擇的是2)
emulator
模擬器相關(guān)(選修)
使用的Linux內(nèi)核文件 Linux Kernel : kernel-qemu
/source/prebuilds/qemu-kernel/arm/kernel-qemu
Android系統(tǒng)鏡像文件: system.img
, userdate.img
, ramdisk.img
source/out/target/product/generic
64位source/out/target/product/generic64
模塊編譯
執(zhí)行source build/envsetup.sh
之后
croot: Changes directory to the top of the tree.
m: Makes from the top of the tree.
mm: Builds all of the modules in the current directory.
mmm: Builds all of the modules in the supplied directories.
cgrep: Greps on all local C/C++ files.
jgrep: Greps on all local Java files.
resgrep: Greps on all local res/*.xml files.
godir: Go to the directory containing a file.
mmm
: 編譯指定目錄
make snod
: 重新打包系統(tǒng)鏡像
系統(tǒng)自帶的apk文件out/target/product/generic/system/apk
可執(zhí)行工具模塊:out/target/product/generic/system/bin
動態(tài)鏈接庫:out/target/product/generic/system/lib
硬件抽象層文件:out/targer/product/generic/system/lib/hw
SDK編譯
執(zhí)行make sdk
即可,但這個(gè)除非定制開發(fā)工具,一般不會執(zhí)行
錯(cuò)誤錦集
- java版本
You are attemping to build with the incorrect version.
解決方法
參看上文安裝對應(yīng)required的Java版本
- bison缺失
prebuilts/misc/linux-x86/bison/bison: m4 subprocess failed: No such file or directory
解決方法
sudo apt-get install flex bison
- flex錯(cuò)誤
Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed
解決方法
export LC_ALL=C
或安裝最新的flex:sudo apt-get install flex
- Out of memory error
Out of memory error (version 1.2-rc4 'Carnac' (298900 f95d7bdecfceb327f9d201a1348397ed8a843843 by android-jack-team@google.com)).
GC overhead limit exceeded.
Try increasing heap size with java option '-Xmx<size>'.
Warning: This may have produced partial or corrupted output.
ninja: build stopped: subcommand failed.
make: *** [ninja_wrapper] Error 1
編譯AOSP主線代碼時(shí),常常會因?yàn)镴VM heap size太小而導(dǎo)致該錯(cuò)誤.
解決方法一
在編譯命令之前,修改prebuilts/sdk/tools/jack-admin
文件,找到文件中的這一行:
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -cp $LAUNCHER_JAR $LAUNCHER_NAME"
然后在該行添加-Xmx4096m,即:
JACK_SERVER_COMMAND="java -XX:MaxJavaStackTraceDepth=-1 -Djava.io.tmpdir=$TMPDIR $JACK_SERVER_VM_ARGUMENTS -Xmx4096m -cp $LAUNCHER_JAR $LAUNCHER_NAME"
解決方法二
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server
修改結(jié)束文件或執(zhí)行完方法二之后,執(zhí)行make
繼續(xù)編譯
如果執(zhí)行jack-admin kill-server
提示命令不存在時(shí),親,這邊建議您重新repo sync
呢
我剛開始使用的是方法二但我又遇到了
Communication error with Jack server (52). Try 'jack-diagnose'
執(zhí)行發(fā)現(xiàn)jack-diagnose
沒有可執(zhí)行權(quán)限,添加之
chmod +x prebuilts/sdk/tools/jack-diagnose
./prebuilts/sdk/tools/jack-diagnose
然后繼續(xù)make
,繼續(xù)Communication error
,排查后發(fā)現(xiàn)一定要記得out/host/linux-x86/bin/jack-admin start-server
如果還不可以,那就先執(zhí)行make clean
,然后再執(zhí)行一遍kill-server
和start-server
,即
make clean
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4096m"
out/host/linux-x86/bin/jack-admin kill-server
out/host/linux-x86/bin/jack-admin start-server
make
emmm...95%,不不90%的問題,應(yīng)該可能也許大概都可以解決了吧...接下來的情況可能要具體情況具體分析了
- file is empty
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/EXECUTABLES/libaapt2_tests_intermediates/split/TableSplitter_test.o: file is empty
解決方法
ln -s /usr/bin/ld.gold prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/x86_64-linux/bin/ld
- emulator黑屏無響應(yīng)
如果是kerner內(nèi)核問題:
解決方法: 使用kernel-qemu-armv7內(nèi)核
./out/host/linux-x86/bin/emulator -partition-size 1024 -kernel ./prebuilts/qemu-kernel/arm/kernel-qemu-armv7
到此如果還沒解決, 不妨嘗試編譯對應(yīng)64位版本