前言
走到這一步, 我們終于可以啟動一下模擬器玩玩了, 經(jīng)過兩天編譯, 感覺什么都好,就是頭冷.

開搞,開搞.
AOSP系列
開搞
自己的配置
硬件
Mac mini (Late 2014)
2.6 GHz i5
8G 1600 MHz DDR3
自己換了三星的500G固態(tài)硬盤
Mac 系統(tǒng)版本: Mojave 10.14.4
源碼
版本: android-6.0.1_r78
JDK 7
Python
verison: 2.7.10
Git
version 2.21.0
啟動模擬器
emulator
command not found
錯誤, 你肯定是在沒有導(dǎo)入環(huán)境的窗口執(zhí)行 emulator 了
-bash: emulator: command not found
這里要先導(dǎo)入環(huán)境, 如下
. build/envsetup.sh
選擇運(yùn)行的項(xiàng)目 (這個和你編譯的一樣)
lunch aosp_arm-eng
ANDROID_PRODUCT_OUT
找不到環(huán)境變量 ANDROID_PRODUCT_OUT
emulator: ERROR: Can't access ANDROID_PRODUCT_OUT as '源碼路徑/out/target/product/geneic_aosp_arm-eng'
直接在當(dāng)前終端窗口增加這個環(huán)境變量, 改到你已經(jīng)編譯好的項(xiàng)目路徑
export ANDROID_PRODUCT_OUT=源碼路徑/out/target/product/generic_aosp_arm-eng
然后再次
emulator
啟動成功
打印如下
emulator: WARNING: system partition size adjusted to match image file (1536 MB > 200 MB)
emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB)
Creating filesystem with parameters:
Size: 69206016
Block size: 4096
Blocks per group: 32768
Inodes per group: 4224
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 16896
Block groups: 1
Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
emulator: ### WARNING: /etc/localtime does not point to /usr/share/zoneinfo/, can't determine zoneinfo timezone name
開機(jī)等了十來分鐘(網(wǎng)上都說幾分鐘, 估計(jì)是我機(jī)子太垃圾...)
上一下效果圖吧
partition
分區(qū)大小問題, 啟動的時候帶上分配大小參數(shù)就行了
emulator: WARNING: system partition size adjusted to match image file (1536 MB > 200 MB)
emulator: WARNING: data partition size adjusted to match image file (550 MB > 200 MB)
解決如下 (3000 單位是 M, 如果你那邊提示需要更大, 那么就分配更多就行了)
emulator -partition-size 3000
時區(qū)問題
時區(qū)問題, 未解決(那位大神知道咋搞, 評論留一下唄)
我這邊 etc/localtime 指向的是 /private/var/db/timezone/tz/2019a.1.0/zoneinfo/Asia/Shanghai ( 為啥只有上海, 沒有北京??? )
但是 /usr/share/zoneinfo/ 也是一個快捷方式而已, 也是 link 到 /private/var/db/timezone/tz/2019a.1.0/zoneinfo
emulator: ### WARNING: /etc/localtime does not point to /usr/share/zoneinfo/, can't determine zoneinfo timezone name
參考文章
https://source.android.google.cn/setup/building.html
http://www.android-doc.com/tools/help/emulator.html