Run apps on the Android Emulator | Android Studio | Android Developers

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 offers these advantages :In most cases, the emulator is the best option for your testing needs. This page covers the core emulator functionalities and how to get started with it .Alternatively, you can deploy your app to a physical device. For more information, see Run apps on a hardware device .

The Android Emulator lets you test your app on many different devices
virtually. The emulator comes with Android Studio, so you don’t
need to install it separately. To use the emulator, follow these basic
steps, which are described in more detail in the sections that follow:

This page covers the steps to set up and explore your virtual testing environment in more detail. If you already have your app running on the emulator and are ready to use more advanced features, see Advanced emulator usage .If you’re experiencing issues with the emulator, see Troubleshoot known issues with Android Emulator. Depending on your needs and resources, it might be worth delving into system requirements and technical configurations, or it might be better to use a physical device .For the best experience, you should use the emulator in Android Studio on a computer with at least the following specs :If you don’t have these specs, the emulator might still run but not smoothly. In this case, consider testing on a physical device instead by following the guidance at Run apps on a hardware device .Each instance of the Android Emulator uses an Android virtual device ( AVD ) to specify the Android version and hardware characteristics of the simulated device. To effectively test your app, create an AVD that models each device your app is designed to run on. To create an AVD, see Create and manage virtual devices .Each AVD functions as an independent device with its own private storage for user data, SD card, and so on. By default, the emulator stores the user data, SD card data, and cache in a directory specific to that AVD. When you launch the emulator, it loads the user data and SD card data from the AVD directory .After you have created an AVD, you can start the Android Emulator and run an app in your project :

Once your app is installed on your AVD, you can run it from the device as you
would run any app on a device. Any time you want to deploy new changes,
you need to click Run or Apply Changes again.

If you want to test your app with Wear OS devices, the Wear OS pairing assistant
guides you step-by-step through pairing Wear OS emulators with physical or
virtual phones directly in Android Studio. To learn more, see
Use the Wear OS emulator pairing
assistant.

While the emulator is running, you can use your computer mouse pointer to mimic your finger on the touch màn hình hiển thị and use the emulator panel to perform common actions .Use your computer mouse pointer to mimic your finger on the touchscreen, select menu items and input fields, and click buttons and controls. Use your computer keyboard to type characters and enter emulator shortcuts .

Table 1. Gestures for navigating the
emulator

To perform common actions with the emulator, use the emulator toolbar, if you’re running the emulator within Android Studio, or the panel on the right side, if you’re running the emulator in a window outside of Android Studio. Table 2 describes common emulator actions and associated buttons .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 macOS ) to open the Help pane in the Extended controls window .

Table 2. Common actions in the emulator

Feature Description
Close
Close icon
Close the emulator.
Minimize
Minimize icon
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
Power icon
Click to turn the screen on or off.
Click and hold to turn the device
on or off.
Volume up
Volume Up icon
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
Volume Down icon
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 Left icon
Rotate the device 90 degrees counterclockwise.
Rotate right
Rotate Right icon
Rotate the device 90 degrees clockwise.
Take screenshot
Take Screenshot icon
Click to take a screenshot of the device.
Enter zoom mode
Enter Zoom Mode icon
Click to change the cursor to the zoom icon. To exit zoom mode, click the button again .
To 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 macOS) while pressing the
arrow keys on the keyboard.

To tap the device màn hình hiển thị in zoom mode, Control-click ( Command-click on macOS ) .

Back
Back icon
Return to the previous screen or close a dialog, an options menu,
the Notifications panel, or the onscreen keyboard.
Home
Home icon
Return to the Home screen.
Overview iconOverview

( Recent Apps )

Tap to open a list of thumbnail images of apps you’ve worked with
recently. To open an app, tap its thumbnail. To remove a thumbnail from the list,
swipe it left or right. This button isn’t supported for Wear OS.
Fold
Fold icon
For foldable devices, fold the device to display its smaller screen
configuration.
Unfold
Unfold icon
For foldable devices, unfold the device to display its larger screen
configuration.
Button 1
Button 1 icon
For Wear devices, press Button 1 on the device. Only available on Wear
devices running API level 28 or higher.
Button 2
Button 2 icon
For Wear devices, press Button 2 on the device. Only available on Wear
devices running API level 30 or higher.
Palm
Palm button icon
For Wear devices, press your palm on the device screen. This sets your
device to ambient mode. Only available on Wear devices running API level 28
or higher.
Tilt
Tilt button icon
For Wear devices, tilt the device. This exits ambient mode. Only
available on Wear devices running API level 28 or higher.
Menu Press Control+M (Command+M on macOS) to simulate the Menu button.
More
More icon
Click to access other features and settings.
Run apps on the Android Emulator | Android Studio | Android Developers

Bài viết liên quan
Hotline 24/7: O984.666.352
Alternate Text Gọi ngay