ubuntu 启动android模拟器

android源码下载完成编译成功后

输入lunch full-eng出现以下内容

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.3
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRI40
============================================

接下来启动编译系统

编译完之后会在out/target/product/generic目录下生成system.img ramdisk.img userdata.img三个镜像文件。

在启动模拟器之前,需要先为模拟器系统设置环境变量,执行gedit ~/.bashrc,新增环境变量如下:

export ANDROID_PRODUCT_OUT=~/Android_platform/out/target/product/generic

ANDROID_PRODUCT_OUT_BIN=~/Android_platform/out/host/linux-x86/bin

export PATH=${PATH}:${ANDROID_PRODUCT_OUT_BIN}:${ANDROID_PRODUCT_OUT};

最后,同步这些变化并启动模拟器:

$ source ~/.bashrc

$ cd ~/Android_platform/out/target/product/generic

$ emulator -system system.img -data userdata.img -ramdisk ramdisk.img


若再次启动出现以下错误:

emulator: ERROR: You did not specify a virtual device name, and the system

directory could not be found.

If you are an Android SDK user, please use '@' or '-avd '

to start a given virtual device (see -help-avd for details).

Otherwise, follow the instructions in -help-disk-images to start the emulator


source build/envsetup.sh

然后,

$ source ~/.bashrc

$ cd ~/Android_platform/out/target/product/generic

$ emulator -system system.img -data userdata.img -ramdisk ramdisk.img





你可能感兴趣的:(ubuntu学习随笔)