The Android Emulator simulates a device and displays it on our development computer. It lets you prototype, develop, and test Android apps without using a hardware device. The emulator supports Android phone, tablet, Android Wear, and Android TV devices. It comes with predefined device types so you can get started quickly, and you can create your own device definitions and emulator skins.
Installation of Android studio is simple, it comes with a simple execution & just takes a while to complete the installation. SDK manager is available with it, so that new version of Android, emulator, SDK tools, play services etc… can be downloaded easily.
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) followed by Launch in the resulting Launch Options dialog. The emulator will appear in a new window and, after a short period of time, the “android” logo will appear in the center of the screen. The first time the emulator is run, it can take up to 10 minutes for the emulator to fully load and start. On subsequent invocations, this will typically reduce to a few minutes. In the event that the startup time on your system is considerable, do not hesitate to leave the emulator running. The system will detect that it is already running and attach to it when applications are launched, thereby saving considerable amounts of startup time.
Another option when using the emulator is to enable the Snapshot option in the AVD settings screen. This option, which can only be used when the Use Host GPU option is disabled, enables the state of an AVD instance to be saved and reloaded next time it is launched. This can result in an emulator startup time of just a few seconds.
To enable snapshots, edit the settings for the AVD configuration and click on the Show Advanced Settings button. In the Emulated Performance section of the advanced settings panel, disable the Use Host GPU option and enable the Store a snapshot for faster startup as outlined in Figure 1.1
Running the Application in the AVD:
With an AVD emulator configured, the example AndroidSample application created in the earlier chapter now can be compiled and run. With the AndroidSample project loaded into Android Studio, simply click on the run button represented by a green triangle located in the Android Studio toolbar as shown in Figure 1-2 below, select the Run -> Run… menu option or use the Shift+F10 keyboard shortcut:
By default, Android Studio will respond to the run request by displaying the Choose Device dialog. This provides the option to execute the application on an AVD instance that is already running, or to launch a new AVD session specifically for this application. Figure 1-3 lists the previously created Nexus7 AVD as a running device as a result of the steps performed in the preceding section. With this device selected in the dialog, click on OK to install and run the application on the emulator.
Error: Time out after 300 seconds waiting for emulator to come online
I recently updated to Android Studio 2.3, and now when I try to run the application, the emulator does not come online. It times out after 300 seconds.
Three days on this, and I believe there’s a race condition between adb and the emulator. On a request to run an app, with no emulator already running, you see the “Initializing ADB”, then the emulator choice, it starts and you get “Waiting for target to come online”.
After trying all the possible solutions without success the one that fixed my problem was simply changing the Graphics configuration for the virtual device from Auto to Software (tried hardware first without success)