-
Notifications
You must be signed in to change notification settings - Fork 13
AndroidEmulator
The Android emulator is a tool that allows developers to develop and test Android application without the need for actual hardware. The emulation is fairly complete because it is built on top of the open source qemu CPU level emulator.
Qemu is a versatile emulator the can emulate different CPU’s and hardware configuration and Android makes use one of these configuration(ARM SoC with custom hardware) and this is the part that is emulated. The qemu source code can be found under external/qemu and contain the definition of a new hardware platform called “goldfish”. The emulator starts a Linux kernel and provides all the tools above this so the “emulation” is very complete in terms of how the system behaves.
| -partition-size | 512 is a nice value. |
By default the root file system will be mostly read-only and the size will be quite small. If you want more head-room you should use the partition-size argument.
It still is possible to use the “hidden” qemu options and this can be fairly useful if you want to attach real hardware to your device.(Modems, Bluetooth devices) or perform tracing. See emulator -qemu -h
Shorted list of usefull options
QEMU PC emulator version 0.10.50Android, Copyright (c) 2003-2008 Fabrice Bellard
usage: qemu [options] [disk_image]
-usb enable the USB driver (will be the default soon)
-usbdevice name add the host or guest USB device 'name'
Debug/Expert options:
-serial dev redirect the serial port to char device 'dev'
-gdb dev wait for gdb connection on 'dev'
-s shorthand for -gdb tcp::1234-usbdevice can under linux be in the for of host:bus.addr
Pass through the host device identified by bus.addr (Linux
only).
It currently is not possible to add a random usb devices when starting the emulator.
(work in progress)
Adding a random usb device
emulator -avd myavd -qemu -usb -usbdevice host:2.5
During startup of the emulator a set of configuration files are read form ~/.android/avd/[adv-name].avd/ these can include image.sysdir arguments and when an add-on is used multiple sysdir items can be added.
Info from external/qemu/avd/info.c
/* Copyright (C) 2008 The Android Open Source Project
*
* technical note on how all of this is supposed to work:
*
* Each AVD corresponds to a "content directory" that is used to
* store persistent disk images and configuration files. Most remarkable
* are:
*
* - a "config.ini" file used to hold configuration information for the
* AVD
*
* - mandatory user data image ("userdata-qemu.img") and cache image
* ("cache.img")
*
* - optional mutable system image ("system-qemu.img"), kernel image
* ("kernel-qemu") and read-only ramdisk ("ramdisk.img")
*
* When starting up an AVD, the emulator looks for relevant disk images
* in the content directory. If it doesn't find a given image there, it
* will try to search in the list of system directories listed in the
* 'config.ini' file through one of the following (key,value) pairs:
*
* images.sysdir.1 = <first search path>
* images.sysdir.2 = <second search path>
*
* The search paths can be absolute, or relative to the root SDK installation
* path (which is determined from the emulator program's location, or from the
* ANDROID_SDK_ROOT environment variable).
*
* Individual image disk search patch can be over-riden on the command-line
* with one of the usual options.
*/