You are reading an excerpt from the Android Studio 3.2 Development Essentials book. Purchase this publication in eBook ($29.99) or Print ($45.99) format Android Studio 3.2 Development Essentials - Android 9 Edition Print and eBook (ePub/PDF/Kindle) editions contain 89 chapters and over 700 pages In the course of developing Android apps in Android Studio it will be necessary to compile and run an application multiple times. An Android application may be tested by installing and running it either on a physical device or in an Android Virtual Device (AVD) emulator environment. Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings. Cannot Launch in AVD in the Emulator. Basic video editing software for mac. ![]() Before an AVD can be used, it must first be created and configured to match the specifications of a particular device model. The goal of this chapter, therefore, is to work through the steps involved in creating such a virtual device using the Nexus 5X phone as a reference example. About Android Virtual Devices AVDs are essentially emulators that allow Android applications to be tested without the necessity to install the application on a physical Android based device. An AVD may be configured to emulate a variety of hardware features including options such as screen size, memory capacity and the presence or otherwise of features such as a camera, GPS navigation support or an accelerometer. As part of the standard Android Studio installation, a number of emulator templates are installed allowing AVDs to be configured for a range of different devices. Additional templates may be loaded or custom configurations created to match any physical Android device by specifying properties such as processor type, memory capacity and the size and pixel density of the screen. Check the online developer documentation for your device to find out if emulator definitions are available for download and installation into the AVD environment. When launched, an AVD will appear as a window containing an emulated Android device environment. Figure 4-1, for example, shows an AVD session configured to emulate the Google Nexus 5X model. New AVDs are created and managed using the Android Virtual Device Manager, which may be used either in command-line mode or with a more user-friendly graphical user interface. Creating a New AVD In order to test the behavior of an application in the absence of a physical device, it will be necessary to create an AVD for a specific Android device configuration. To create a new AVD, the first step is to launch the AVD Manager. This can be achieved from within the Android Studio environment by selecting the Tools -> Android -> AVD Manager menu option from within the main window. Once launched, the tool will appear as outlined in Figure 4-2 if existing AVD instances have been created: To add an additional AVD, begin by clicking on the Create Virtual Device button in order to invoke the Virtual Device Configuration dialog: Within the dialog, perform the following steps to create a Nexus 5X compatible emulator: From the Category panel, select the Phone option to display the list of available Android tablet AVD templates. Select the Nexus 5X device option and click Next. On the System Image screen, select the latest version of Android (at time of writing this is API level 28, Android 9.0 with Google Play) for the x86 ABI. Note that if the system image has not yet been installed a Download link will be provided next to the Release Name. Click this link to download and install the system image before selecting it. If the image you need is not listed, click on the x86 images and Other images tabs to view alternative lists. Click Next to proceed and enter a descriptive name (for example Nexus 5X API 28) into the name field or simply accept the default name. Click Finish to create the AVD. With the AVD created, the AVD Manager may now be closed. If future modifications to the AVD are necessary, simply re-open the AVD Manager, select the AVD from the list and click on the pencil icon in the Actions column of the device row in the AVD Manager. Starting the Emulator To perform a test run of the newly created AVD emulator, simply select the emulator from the AVD Manager and click on the launch button (the green triangle in the Actions column).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |