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 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:
if [[ -e /usr/lib/jvm/java-8-openjdk-amd64 ]]; then
fi# Android tools
if [[ -e $HOME/android-sdk-tools ]]; then
export REPO_OS_OVERRIDE="linux" adb kill-server 2> /dev/null
export ADB_SERVER_SOCKET=tcp:$(cat /etc/resolv.conf | grep nameserver | cut -d' ' -f2):5037
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.