ubuntu 启动android模拟器

本文介绍如何在完成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 '@<name>' or '-avd <name>'

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





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值