How To Set Up An Emulator
Create and manage virtual devices
An Android Virtual Device (AVD) is a configuration that defines the characteristics of an Android phone, tablet, Vesture Bone, Android Tv set, or Automotive Bone device that y'all want to simulate in the Android Emulator. The Device Director is an interface y'all can launch from Android Studio that helps you create and manage AVDs.
To open the new Device Manager, practice one of the following:
- From the Android Studio Welcome screen, select More Deportment > Virtual Device Manager.
- After opening a project, select View > Tool Windows > Device Director from the main menu bar.
About AVDs
An AVD contains a hardware profile, organisation epitome, storage area, peel, and other properties.
We recommend that you create an AVD for each system image that your app could potentially support based on the <uses-sdk>
setting in your manifest.
Hardware profile
The hardware profile defines the characteristics of a device equally shipped from the factory. The Device Director comes preloaded with certain hardware profiles, such every bit Pixel devices, and yous can define or customize the hardware profiles every bit needed.
Observe that only some hardware profiles are indicated to include Play Store. This indicates that these profiles are fully CTS compliant and may use system images that include the Play Store app.
Organization images
A organization paradigm labeled with Google APIs includes admission to Google Play services. A organisation prototype labeled with the Google Play logo in the Play Store column includes the Google Play Store app and access to Google Play services, including a Google Play tab in the Extended controls dialog that provides a convenient push for updating Google Play services on the device.
To ensure app security and a consequent experience with physical devices, system images with the Google Play Store included are signed with a release key, which means that y'all cannot become elevated privileges (root) with these images. If you crave elevated privileges (root) to assistance with your app troubleshooting, you lot can apply the Android Open up Source Projection (AOSP) organization images that do not include Google apps or services.
Storage area
The AVD has a dedicated storage area on your development machine. Information technology stores the device user data, such as installed apps and settings, equally well as an emulated SD carte. If needed, you can use the Device Director to wipe user data, then the device has the aforementioned data as if it were new.
Pare
An emulator skin specifies the appearance of a device. The Device Director provides some predefined skins. You lot can also define your own, or use skins provided by 3rd parties.
AVD and app features
Exist sure your AVD definition includes the device features your app depends on. See Hardware Contour Properties and AVD Properties for lists of features yous tin define in your AVDs.
Create an AVD
Tip: If yous want to launch your app into an emulator, instead run your app from Android Studio and then in the Select Deployment Target dialog that appears, click Create New Virtual Device.
To create a new AVD:
- Open the Device Manager.
- Click Create Device.
The Select Hardware window appears.
Notice that simply some hardware profiles are indicated to include Play Store. This indicates that these profiles are fully CTS compliant and may utilise system images that include the Play Store app.
- Select a hardware profile, then click Next.
- Select the system image for a particular API level, and then click Side by side.
- Alter AVD properties every bit needed, and then click End.
Click Show Advanced Settings to show more than settings, such as the skin.
If you don't see the hardware profile you desire, you tin can create or import a hardware profile.
The System Image folio appears.
The Recommended tab lists recommended arrangement images. The other tabs include a more complete list. The right pane describes the selected system image. x86 images run the fastest in the emulator.
If you see Download next to the system prototype, you need to click information technology to download the organization image. You must exist continued to the net to download it.
The API level of the target device is important, because your app won't exist able to run on a system image with an API level that's less than that required by your app, as specified in the minSdkVersion
attribute of the app manifest file. For more information about the human relationship between system API level and minSdkVersion
, run across Versioning Your Apps.
If your app declares a <uses-library>
element in the manifest file, the app requires a system prototype in which that external library is present. If you lot want to run your app on an emulator, create an AVD that includes the required library. To do and so, you might need to utilise an add-on component for the AVD platform; for example, the Google APIs add-on contains the Google Maps library.
The Verify Configuration page appears.
The new AVD appears in the Virtual tab of the Device Manager and the target drop-downwards menu.
To create an AVD starting with a re-create:
- From the Virtual tab of the Device Managing director, click Carte du jour and select Duplicate.
- Click Change or Previous if yous demand to make changes on the Organisation Epitome and Select Hardware pages.
- Make your changes, and then click Cease.
The Verify Configuration page appears.
The AVD appears in the Virtual tab of the Device Manager.
Create a hardware profile
The Device Manager provides predefined hardware profiles for mutual devices so y'all can easily add them to your AVD definitions. If you need to define a unlike device, you can create a new hardware contour. You tin define a new hardware profile from the starting time, or copy a hardware contour as a outset. The preloaded hardware profiles aren't editable.
To create a new hardware profile from the beginning:
- In the Select Hardware page, click New Hardware Contour.
- In the Configure Hardware Profile page, change the hardware profile backdrop equally needed.
- Click Finish.
Your new hardware profile appears in the Select Hardware folio. You lot tin can optionally create an AVD that uses the hardware profile by clicking Next. Or, click Cancel to return to the Virtual tab or target device drop-down menu.
To create a hardware contour starting with a re-create:
- In the Select Hardware folio, select a hardware contour and click Clone Device.
- In the Configure Hardware Contour folio, change the hardware profile properties as needed.
- Click End.
Or right-click a hardware profile and select Clone.
Your new hardware contour appears in the Select Hardware page. Y'all can optionally create an AVD that uses the hardware contour by clicking Side by side. Or, click Cancel to return to the Virtual tab or target device drop-downwardly card.
Edit existing AVDs
From the Virtual tab of the Device Manager, you lot tin perform the following operations on an existing AVD:
Edit existing hardware profiles
From the Select Hardware page, y'all tin perform the post-obit operations on an existing hardware profile:
- To edit a hardware profile, select it and click Edit Device. Or correct-click a hardware profile and select Edit. Adjacent, make your changes.
- To delete a hardware profile, right-click it and select Delete.
You can't edit or delete the predefined hardware profiles.
Run and stop an emulator, and clear information
From the Virtual tab, you can perform the following operations on an emulator:
Import and export hardware profiles
From the Select Hardware page, yous tin import and export hardware profiles:
- To import a hardware profile, click Import Hardware Profiles and select the XML file containing the definition on your computer.
- To consign a hardware contour, right-click it and select Export. Specify the location where y'all desire to shop the XML file containing the definition.
Hardware contour properties
You lot can specify the following backdrop of hardware profiles in the Configure Hardware Profile page. AVD configuration properties override hardware profile properties, and emulator properties that yous fix while the emulator is running override them both.
The predefined hardware profiles included with the Device Managing director aren't editable. All the same, you tin can copy them and edit the copies.
Hardware Contour Property | Clarification |
---|---|
Device Proper name | Name of the hardware contour. The name tin can incorporate uppercase or lowercase letters, numbers from 0 to ix, periods (.), underscores (_), parentheses ( () ), and spaces. The name of the file storing the hardware profile is derived from the hardware profile proper name. |
Device Type | Select i of the following:
|
Screen Size | The physical size of the screen, in inches, measured at the diagonal. If the size is larger than your computer screen, information technology'south reduced in size at launch. |
Screen Resolution | Type a width and meridian in pixels to specify the total number of pixels on the simulated screen. |
Round | Select this option if the device has a round screen, such equally some Wear OS devices. |
Memory: RAM | Type a RAM size for the device and select the units, i of B (byte), KB (kilobyte), MB (megabyte), GB (gigabyte), or TB (terabyte). |
Input: Has Hardware Buttons (Back/Home/Carte du jour) | Select this option if your device has hardware navigation buttons. Deselect it if these buttons are implemented in software simply. If you lot select this option, the buttons won't appear on the screen. You lot tin apply the emulator side console to "press" the buttons, in either case. |
Input: Has Hardware Keyboard | Select this option if your device has a hardware keyboard. Deselect it if information technology doesn't. If you select this choice, a keyboard won't appear on the screen. You tin use your computer keyboard to ship keystrokes to the emulator, in either example. |
Navigation Style | Select one of the following:
These options are for actual hardware controls on the device itself. However, the events sent to the device past an external controller are the aforementioned. |
Supported Device States | Select ane or both options:
If you select both, you tin switch between orientations in the emulator. You must select at to the lowest degree one option to go on. |
Cameras | To enable the photographic camera, select one or both options:
After, you can use a webcam or a photograph provided by the emulator to simulate taking a photograph with the camera. |
Sensors: Accelerometer | Select if the device has hardware that helps the device determine its orientation. |
Sensors: Gyroscope | Select if the device has hardware that detects rotation or twist. In combination with an accelerometer, information technology can provide smoother orientation detection and back up a vi-centrality orientation organisation. |
Sensors: GPS | Select if the device has hardware that supports the Global Positioning Organization (GPS) satellite-based navigation system. |
Sensors: Proximity Sensor | Select if the device has hardware that detects if the device is shut to your face during a phone phone call to disable input from the screen. |
Default Skin | Select a skin that controls what the device looks like when displayed in the emulator. Remember that specifying a screen size that'south too big for the resolution tin can hateful that the screen is cutting off, then you tin can't come across the whole screen. See Create an emulator skin for more information. |
AVD properties
Yous tin can specify the following properties for AVD configurations in the Verify Configuration page. The AVD configuration specifies the interaction between the evolution reckoner and the emulator, likewise as properties you desire to override in the hardware profile.
AVD configuration backdrop override hardware contour properties. Emulator properties that you ready while the emulator is running override them both.
AVD Property | Description |
---|---|
AVD Name | Name of the AVD. The name tin can incorporate uppercase or lowercase letters, numbers from 0 to 9, periods (.), underscores (_), parentheses ( () ), dashes (-), and spaces. The name of the file storing the AVD configuration is derived from the AVD name. |
AVD ID (Avant-garde) | The AVD filename is derived from the ID, and y'all can employ the ID to refer to the AVD from the control line. |
Hardware Profile | Click Change to select a different hardware profile in the Select Hardware page. |
System Image | Click Alter to select a different system image in the Organisation Prototype page. An active cyberspace connection is required to download a new paradigm. |
Startup Orientation | Select ane option for the initial emulator orientation:
An option is enabled simply if information technology's selected in the hardware profile. When running the AVD in the emulator, y'all can alter the orientation if both portrait and landscape are supported in the hardware profile. |
Camera (Advanced) | To enable a camera, select one or both options:
The Emulated setting produces a software-generated image, while the Webcam setting uses your evolution computer webcam to take a moving picture. This option is bachelor simply if it'south selected in the hardware profile; information technology's not available for Wear Bone and Android TV. |
Network: Speed (Advanced) | Select a network protocol to decide the speed of information transfer:
|
Network: Latency (Advanced) | Select a network protocol to set how much time (delay) it takes for the protocol to transfer a data packet from one signal to some other bespeak. |
Emulated Operation: Graphics | Select how graphics are rendered in the emulator:
|
Emulated Performance: Boot choice (Advanced) |
|
Emulated Performance: Multi-Core CPU (Avant-garde) | Select the number of processor cores on your computer that you'd similar to use for the emulator. Using more processor cores speeds up the emulator. |
Retentivity and Storage: RAM | The amount of RAM on the device. This value is prepare by the hardware manufacturer, only you can override it, if needed, such as for faster emulator operation. Increasing the size uses more resources on your computer. Type a RAM size and select the units, one of B (byte), KB (kilobyte), MB (megabyte), GB (gigabyte), or TB (terabyte). |
Retention and Storage: VM Heap | The VM heap size. This value is set by the hardware manufacturer, only you lot can override it, if needed. Blazon a heap size and select the units, ane of B (byte), KB (kilobyte), MB (megabyte), GB (gigabyte), or TB (terabyte). For more information on Android VMs, run into Retentivity Management for Different Virtual Machines. |
Retentivity and Storage: Internal Storage | The amount of nonremovable memory infinite bachelor on the device. This value is gear up by the hardware manufacturer, but you can override information technology, if needed. Type a size and select the units, one of B (byte), KB (kilobyte), MB (megabyte), GB (gigabyte), or TB (terabyte). |
Retentiveness and Storage: SD Bill of fare | The amount of removable memory space available to store data on the device. To use a virtual SD menu managed by Android Studio, select Studio-managed, blazon a size, and select the units, one of B (byte), KB (kilobyte), MB (megabyte), GB (gigabyte), or TB (terabyte). A minimum of 100 MB is recommended to apply the camera. To manage the infinite in a file, select External file and click ... to specify the file and location. For more than information, encounter mksdcard and AVD data directory. |
Device Frame: Enable Device Frame | Select to enable a frame effectually the emulator window that mimics the look of a real device. |
Custom Peel Definition (Advanced) | Select a skin that controls what the device looks like when displayed in the emulator. Remember that specifying a screen size that's too large for the skin can mean that the screen is cutting off, so you can't see the whole screen. Encounter Create an emulator peel for more data. |
Keyboard: Enable Keyboard Input (Advanced) | Select this option if you want to apply your hardware keyboard to interact with the emulator. It's disabled for Wear Os and Android Television receiver. |
Create an emulator skin
An Android emulator skin is a collection of files that define the visual and control elements of an emulator display. If the skin definitions available in the AVD settings don't meet your requirements, you can create your own custom peel definition, so apply information technology to your AVD.
Each emulator pare contains:
- A
hardware.ini
file - Layout files for supported orientations (mural, portrait) and physical configuration
- Paradigm files for display elements, such equally background, keys and buttons
To create and use a custom pare:
- Create a new directory where you will save your skin configuration files.
- Define the visual appearance of the skin in a text file named
layout
. This file defines many characteristics of the peel, such equally the size and prototype assets for specific buttons. For example:parts { device { display { width 320 superlative 480 x 0 y 0 } } portrait { background { image background_port.png } buttons { power { prototype button_vertical.png x 1229 y 616 } } } ... }
- Add the bitmap files of the device images in the same directory.
- Specify additional hardware-specific device configurations in a
hardware.ini
file for the device settings, such ashw.keyboard
andhw.lcd.density
. - Archive the files in the peel folder and select the archive file equally a custom skin.
For more detailed information about creating emulator skins, see the Android Emulator Skin File Specification in the tools source lawmaking.
Content and code samples on this page are discipline to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-01-25 UTC.
How To Set Up An Emulator,
Source: https://developer.android.com/studio/run/managing-avds
Posted by: morenoentils1983.blogspot.com
0 Response to "How To Set Up An Emulator"
Post a Comment