. Meet Android Studio. Manage your project. Add C and C code.
Write your app. Build and run your app. Run apps on the emulator.
Run apps on a hardware device. Configure your build. Debug your app. Test your app. monkeyrunner reference.
Profile your app. Inspect CPU activity.
Publish your app. Command line tools. The Android Emulator simulates Android devices on your computer so that you can test your application on a variety of devices and Android API levels without needing to have each physical device. The emulator provides almost all of the capabilities of a real Android device. You can simulate incoming phone calls and text messages, specify the location of the device, simulate different network speeds, simulate rotation and other hardware sensors, access the Google Play Store, and much more. Testing your app on the emulator is in some ways faster and easier than doing so on a physical device.
For example, you can transfer data faster to the emulator than to a device connected over USB. The emulator comes with predefined configurations for various Android phone, tablet, Wear OS, and Android TV devices. Watch the following video for an overview of some emulator features.
You can use the emulator manually through its graphical user interface and programmatically through the command line and the emulator console. For a comparison of the features available through each interface, see.
Install the emulator To install the Android Emulator, select the Android Emulator component in the SDK Tools tab of the SDK Manager. For instructions, see. (touch) Point to the screen, press the primary mouse button, and then release. For example, you could click a text field to start typing in it, select an app, or press a button. Double tap Point to the screen, press the primary mouse button quickly twice, and then release. Touch and hold Point to an item on the screen, press the primary mouse button, hold, and then release. For example, you could open options for an item.
Type You can type in the emulator by using your computer keyboard, or using a keyboard that pops up on the emulator screen. For example, you could type in a text field after you selected it. Pinch and spread.
Clicking the left mouse button acts like touching down both points, and releasing acts like picking both up. Vertical swipe Open a vertical menu on the screen and use the scroll wheel (mouse wheel) to scroll through the menu items until you see the one you want. Click the menu item to select it. Perform common actions in the emulator To perform common actions with the emulator, use the panel on the right side, as described in table 2.
You can use keyboard shortcuts to perform many common actions in the emulator. For a complete list of shortcuts in the emulator, press F1 (Command+/ on Mac) to open the Help pane in the window.
Common actions in the emulator Feature Description Close Close the emulator. Minimize Minimize the emulator window. Resize Resize the emulator as you would any other operating system window. The emulator maintains an aspect ratio appropriate for your device. Power Click to turn the screen on or off.
Click and hold to turn the device on or off. Volume up Click to view a slider control and turn the volume up. Click again to turn it up more, or use the slider control to change the volume. Volume down Click to view a slider control and turn the volume down. Click again to turn it down more, or use the slider control to change the volume. Rotate left Rotate the device 90 degrees counterclockwise. Rotate right Rotate the device 90 degrees clockwise.
Take screenshot Click to take a screenshot of the device. For details, see. Enter zoom mode Click so the cursor changes to the zoom icon.
To exit zoom mode, click the button again. Zoom in and out in zoom mode:.
Left-click the screen to zoom in by 25%, up to a maximum of about twice the screen resolution of the virtual device. Right-click to zoom out. Left-click and drag to select a box-shaped area to zoom in on. Right-click and drag a selection box to reset to default zoom. To pan in zoom mode, hold Control (Command on Mac) while pressing the arrow keys on the keyboard.
To tap the device screen in zoom mode, Control-click (Command-click on Mac). Back Return to the previous screen, or close a dialog box, an options menu, the Notifications panel, or the onscreen keyboard. Home Return to the Home screen. (Recent Apps) Tap to open a list of thumbnail images of apps you’ve worked with recently. To open an app, tap it. To remove a thumbnail from the list, swipe it left or right. This button isn't supported for Wear OS.
Menu Press Control+M (Command+M on Mac) to simulate the Menu button. More Click to access other features and settings, described in the next table. Screen recording You can record video and audio from the Android Emulator and save the recording to a WebM or animated GIF file. The screen recording controls are in the Screen record tab of the window. Tip: You can also open the screen recording controls by pressing Control + Shift + R (Command + Shift + R on Mac). To begin screen recording, click the Start recording button in the Screen record tab.
To stop recording, click Stop recording. Controls for playing and saving the recorded video are at the bottom of the Screen record tab. To save the video, choose WebM or GIF from the menu at the bottom of the tab and click Save. You can also record and save a screen recording from the emulator using the following command on the command line: adb emu screenrecord start -time-limit 10 path to save video/samplevideo.webm Screenshots To take a screenshot of the virtual device, click the Take screenshot button. The emulator creates a PNG file with the name Screenshot yyyymmdd-hhmmss.png using the year, month, day, hour, minute, and second of the capture.
For example, Screenshot20148.png. By default, the screenshot is saved on your comupter desktop. To change the location to which screenshots are saved, use the Screenshot save location control in the Settings category in the emulator's window. You can also take screenshots from the command line with either of the following commands:.
screenrecord screenshot destination-directory. adb emu screenrecord screenshot destination-directory Virtual scene camera and ARCore You can use the virtual scene camera in a virtual environment to experiment with augmented reality (AR) apps made with. For information on using the virtual scene camera in the emulator, see. When using the emulator with a camera app, you can import an image in PNG or JPEG format to be used within a virtual scene. To choose an image for use in a virtual scene, click Add image in the Camera Virtual scene images tab in the Extended controls window.
This feature can be used to import custom images such as QR codes for use with any camera-based app. For more information, see. Extended controls, settings, and help Use the extended controls to send data, change device properties, control apps, and more. To open the Extended controls window, click More in the emulator panel. You can use keyboard shortcuts to perform many of these tasks.
For a complete list of shortcuts in the emulator, press F1 (Command+/ on Mac) to open the Help pane. Extended controls details Feature Description Location The emulator lets you simulate 'my location' information: the location where the emulated device is currently located. For example, if you click My Location in Google Maps and then send a location, the map shows it. To send a GPS location:. Select Decimal or Sexagesimal. Specify the location.
In decimal mode, enter a Latitude value in the range -90.0 to +90.0 degrees and a Longitude value in the range -180.0 to +180.0 degrees. In sexigesimal mode, enter a three-part Latitude value in the range -90 to +90 degrees, 0 to 59 minutes, and 0.0 to 60.0 seconds. Enter a Longitude value in the range -180 to +180 degrees, 0 to 59 minutes, and 0.0 to 60.0 seconds. For the latitude, - indicates south and + indicates north; for the longitude, - indicates west and + indicates east.
The + is optional. Optionally specify an Altitude value in the range -1,000.0 to +10,000.0 meters. Click Send.
To use geographic data from a GPS exchange format (GPX) or Keyhole Markup Language (KML) file:. Click Load GPX/KML.
In the file dialog, select a file on your computer and click Open. Optionally select a Speed. The speed defaults to the Delay value ( Speed 1X). You can increase the speed by double ( Speed 2X), triple ( Speed 3X), and so on. Click Run. Cellular The emulator lets you simulate various network conditions.
You can approximate the network speed for different network protocols, or you can specify Full, which transfers data as quickly as your computer allows. Specifying a network protocol is always slower than Full. You can also specify the voice and data network status, such as roaming. The defaults are set in the AVD.