Setting up an Android Emulator on a Windows 11 (64-bit) system with an AMD Ryzen 9 5900X and 32GB RAM, using Hyper-V enabled VMs and Android Studio Emulator:
Prerequisites
Before you begin, ensure that you have the following prerequisites:
- A Windows 11 (64-bit) system with Hyper-V enabled.
- Android Studio installed on your system.
- An Android Virtual Device (AVD) configuration set up in Android Studio.
Enabling Hyper-V
- Press
Win + Xand selectWindows Terminal (Admin). - Run the following command to enable Hyper-V:
dism.exe /online /enable-feature /featurename:Microsoft-Hyper-V /all
- Restart your system when prompted.
Configuring Hyper-V Virtual Switch
-
Press
Win + Xand selectWindows Features. -
Scroll down and expand
Hyper-V. -
Check
Hyper-V Management ToolsandVirtual Machine Connection. -
Click
OKand wait for the features to install. -
Restart your system when prompted.
-
Open
Local Administrator Toolsand selectHyper-V Manager. -
In the
Actionspane, clickVirtual Switch Manager. -
Click
New Virtual Network Switchand selectExternal. -
Name the virtual switch, select the network adapter you want to use, and click
OK.
Configuring Android Studio for Hyper-V
- Open Android Studio and click
Configurein the top-right corner. - Select
Preferencesand navigate toTools>Android>AVD Manager. - Click the
Editbutton next to the AVD you want to use. - In the
Hardwaresection, checkUse Host GPU. - In the
Emulated Performancesection, checkUse Hyper-V (Windows only). - Click
OKto save the changes.
Starting the Android Emulator
- In the Android Studio toolbar, click the
AVD Managericon. - Select the AVD you want to use and click
Play. - Wait for the emulator to boot up.
Troubleshooting
If you encounter any issues, try the following troubleshooting steps:
- Ensure that your system meets the minimum requirements for running the Android Emulator.
- Make sure that your network adapter is compatible with Hyper-V.
- Check that the Hyper-V virtual switch is correctly configured.
- Try using a different AVD configuration or updating Android Studio.