Hardware Profiles For Android Studio

What is an Android Virtual Device (AVD)? An AVD is an emulation of a real Android machine on a PC. It enables testing of Android applications (Apps) on a code development computer.

  • If you run Android Studio and can't see the emulator listed in the drop-down list of devices then you need to edit the registry. Run Regedit and create or edit the key: HKEYLOCALMACHINE SOFTWARE Wow6432Node Android SDK Tools. Notice the spaces in Android SDK Tools. Add the variable Path and set it to the directory where the SDK is stored.
  • If all the existing virtual devices do not fit your needs, click New Hardware Profile or Import Hardware Profiles button to add your customized virtual devices as you need. For normal use, choose an existing one is enough. Click Next button, then System Image window will be shown. This window list various versions of android OS.
  • The hardware profile defines the characteristics of a device as shipped from the factory. The AVD Manager comes preloaded with certain hardware profiles, such as Pixel devices, and you can define or customize the hardware profiles as needed. Notice that only some hardware profiles are indicated to include Play Store.

Why Use Android Virtual Devices?

Android has been around for a few years with devices manufactured to cover various market segments, from mobile and tablet through to watches and TV. There are low cost devices and high specification, high value devices and a wide range of hardware options. For all these reasons there is a large range of Android devices running various operating system (OS) versions. A successful App will run on many of these devices. However, an App developer may not physically own a good range of devices. Testing is done on a small selection of real devices supported by AVDs.

Android: Basic AVD Hardware profile for the Huawei Mate 20 X phone - avd-hardware-profile-huawei-mate-20x.xml.

Use AVDs to Test Apps on Different Hardware Profiles

The Android Software Development Kit (SDK) comes with the device emulation tool. Allowing different combinations of AVD hardware and OS versions to be configured. Testing on different AVD combinations reduces issues related to hardware differences in real devices, as used by Android Play customers. Boosting confidence that the App will run reliably when released.

Other reasons for using AVDs for testing:

Hardware Profiles For Android Studio 2020

  • Multiple AVD configurations to test an App at different screen sizes.
  • Different (emulated) hardware configurations can be used, for example a device with a keyboard or without.
  • A compiled App is automatically installed and started when the Run button is pressed in Android Studio.
  • Testing on AVDs reduces the amount of physical device testing.
  • AVDs can be used alongside a physical device.
  • You don't need to handicap you physical device to induce error conditions, e.g. testing on a device with no SD card, just set up an AVD with no SD card.
  • An AVD can simulate network events without the costs involved in using a physical device, e.g. simulate phone calls or send an SMS between two AVDs.
  • Simulate GPS data from an AVD from different physical locations without moving from your desk.
  • When App users report bugs you can try and mimic their hardware configurations using AVDs.

Note: Real Android devices plugged into development machines usually provide better performance for testing Apps than AVDs.

Configuring an AVD

Set up an AVD for App testing using the AVD Manager program. In Android Studio to run AVD Manager use the toolbar icon or select Android in the Tools menu. (There is a version of AVD Manager.exe that can be run outside of Studio, in the Android SDK install directory. To locate it in Windows type AVD at the Start screen to find it.)

To create an AVD select the Create Virtual Device button. The Virtual Device Configuration wizard loads.

Choose a common predefined device or generate a new device profile for testing specific hardware configurations. Use the remaining wizard screens to configure the AVD.

Hardware Profile Settings

This table lists the AVD supported properties that can be configured for emulatedhardware and AVD start up configuration.

PropertyValuesDescription
Device NameStringName of the device profile
Device TypePhone/Tablet, Wear or TVDevice category
Screen SizeInchesLength of screen diagonal
ResolutionX and Y PixelsNumber of width and height pixels
MemorySet RAM in bytes, KB, MB, GB or TBAmount of physical RAM emulated
Hardware InputPhysical Back/Home/Menu buttons and KeyboardEmulate buttons and keyboard
OrientationPortrait and/or LandscapeSupported orientation states
CamerasFront and/or BackSupported cameras (emulated or PC cam)
SensorsAccelerometer, Gyroscope, GPS, ProximitySupported sensors
Skin and frameSelect appearanceSkin the emulated device
SystemSelect Android OS versionAndroid API to emulate
ScaleAuto or select dp units to pixelsCustomise screen density
PerformanceAuto, GPU for graphics, software emulationGPU Emulation
Multi-Core1 to 4Select number of cores
Network SpeedFull, HSDPA, UMTS, EDGE, GPRS, HSCSD, GSMEmulate the network speed
Network LatencyUMTS, EDGE, GPRSEmulate the network latency
VM HeapJava heap in bytes, KB, MB, GB or TBJava Virtual Machine heap
Internal StorageNon-removal space in bytes, KB, MB, GB or TBEmulated internal memory
SD cardSize in bytes, KB, MB, GB or TB or existing fileEmulated removable SD card
KeyboardEnable/DisableAllow keyboard input

Notes on AVD Settings

Huawei Hardware Profiles For Android Studio

  • CPU/ABI refers to the target CPU type and the Application Binary Interface (ARM/x86/x86_64). x86 targets perform better than ARM, especially with the Intel Hardware Acceleration Manager (HAXM) installed (by default) on the development computer.
  • When naming a new emulated Android device make it descriptive, for example if emulating a device with a version 4.4 operating system and medium resolution screen (HVGA) a name such as And-v4.4-HVGA is better than Android-Device as it is easier to pick out in the list of configured AVDs.
  • For the emulated Secure Digital (SD) card the bigger the specified size the bigger the file created on the host computer. Alternatively select an existing SD card image, allowing SD card data sharing amongst different AVDs. On a Windows machine the sdcard.img files will be found in the sub-folders of the avd directory, under the .android directory in the logged on user's profile. (Use the Show on Disk drop down menu option next to the AVD listed in the AVD Manager.)
  • Use snapshots if you want the runtime state of the emulated device to persist between sessions. It also reduces the start up time of an AVD for subsequent runs. Though shutdown is longer as the snapshot is written to disk, and host GPU cannot be used to improve AVD graphics performance.
  • Use the Wipe Data drop down menu option in the AVD Manager to clear data in the AVD. When the AVD is started the user data file is reset, any user data generated from previous sessions of the selected AVD is lost.

Note on HAXM

The Intel Hardware Accelerated Execution Manager (HAXM) software is installed by default with Android Studio (unless deselected), alternatively see the Intel HAXM home page. HAXM is a hardware assisted virtualization engine (hypervisor). To benefit from HAXM the following is required:

Hardware Profiles For Android Studio
  • Check the bios documentation for your PC to see if the motherboard and processor of your development machine supports Intel VT (Virtualization Technology).
  • Intel VT must be turned on in the BIOS (see your PCs documentation on how to do that).
  • If HAXM has not been installed by Studio download it via the Android SDK using SDK Manager (under Extras) or from Intel. The version of HAXM installed by Studio is out of date. Uninstall it via control panel and install the latest version.

Hardware Profiles For Android Studio Download

Launching AVDs

Once the AVD has been defined it will be listed in the AVD Manager window. The AVD is ready to be loaded using the launch (i.e. run or play) button. Once loaded it can be used like any other Android device and driven from the mouse (or keyboard) of the development computer.

Hardware Profiles For Android Studio 7

See Also

Hardware Profiles For Android Studio 2

Additional details on AVDs and emulation is available in the Android developer documention. The emulator key mapping is a useful reference.

Selecting Add Device Definition... from the Device in Editor drop-down will open the AVD manager. To create a new hardware profile click on the Create Virtual Device... button. The Select Hardware dialog allows us to install and edit all the device profiles listed in the previous drop-down as well as the option to create or import a definition.

A standalone version of the AVD manager can be run from userAppDataLocalAndroidsdk. This can be useful on lower end machines, as AVDs can be booted up without Studio running.

Hardware Profiles For Android Studio

It is usually easier to take an existing definition and adapt it to our needs, but to gain further insight into the operation, here we will create one from scratch by clicking on the New Hardware Profile ...

Comments are closed.