Appendix B

Using the Android Emulator

The Android emulator ships with the Android SDK and is an invaluable tool to help test your application without requiring you to purchase a real device. While you should thoroughly test your applications on real devices before you deploy them, the emulator mimics most of the capabilities of real devices. It is a very handy tool that you should make use of during the development stage of your project. This appendix provides some common tips and tricks for mastering the Android emulator.

USES OF THE ANDROID EMULATOR

As discussed in Chapter 1, you can use the Android emulator to emulate the different Android configurations by creating Android Virtual Devices (AVDs).

If you want to emulate a real device, first create an AVD with the same screen resolution and abstracted LCD density as that of your real device (see the section “Emulating Devices with Different Screen Sizes” in this appendix for how to do this). You then launch the Android emulator by directly starting the AVD you have created in the AVD Manager window (see Figure B-1). Simply select the AVD and click the Start button. If you want the emulator to display using the same screen size as a real device, check the “Scale display to real size” option and set the “Screen Size (in)” option to the size of your real device. Enter the dpi of your current monitor (if you don’t know it, click the ? button and select your monitor size and resolution). The Android emulator will then display a screen ...

Get Beginning Android™ 4 Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.