Using the Android emulator on Windows 10 with WSL2

Unfortunately it’s not that simple to run the Android emulator in Windows 10 and start, for example, a React-Native app from WSL2 inside this Android emulator.

The Android Device Manager installed with Visual Studio 2019.

The emulator you want to use in Windows need to be installed in WSL2 too with the exact same version.

Here after you will a few commands I used in WSL2 (Ubuntu) to set up my environment:

Some environment variables are required by Java and Android tools. This is the relevant part of my .zshrc file:

Those environment variables need to be added before using the sdk-manager tool from the first snippet.

Be aware also that the adb server must not be started in WSL2 since we want to use the emulator in Windows. So each time WSL2 starts, we need to kill the adb server of WSL2.

To use adb from windows, you can follow my other post here.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store