1. 用envsetup.sh
初始化环境
$ source build/envsetup.sh
或者
$ . build/envsetup.sh
2. 选择lunch的目标
$ lunch full-eng
All build targets take the form BUILD-BUILDTYPE, where the BUILD is a codename referring to
the particular feature combination. Here's a partial list:
Build name | Device | Notes |
---|---|---|
full | emulator | fully configured with all languages, apps, input methods |
full_maguro | maguro | full build running on Galaxy Nexus GSM/HSPA+ ("maguro") |
full_panda | panda | full build running on PandaBoard ("panda") |
and the BUILDTYPE is one of the following:
Buildtype | Use |
---|---|
user | limited access; suited for production |
userdebug | like "user" but with root access and debuggability; preferred for debugging |
eng | development configuration with additional debugging tools |
3. 编译
$ make -j4
4. 运行
你可以在模拟器上运行,也可以将编译結果刷到机器上. 请注意的是: 在lunch的时候就选择好了相关的目标,这样编译后的結果就可以在相应的目标上运行。
(1) 将编译結果刷到机器上
To flash a device, you will need to use fastboot
, which should be included in your path after a successful build. Place the device in fastboot
mode either manually by holding the appropriate key combination at boot, or from the shell with
$ adb reboot bootloader
Once the device is in fastboot mode, run
$ fastboot flashall -w
The -w
option wipes the /data
partition on the device; this is useful for your first time flashing a particular device, but is otherwise unnecessary.
(2) 模拟器运行
在编译的过程中,emulator已经自动地加入到路径中,可以用以下命令运行emulator.
$ emulator