

iex "netsh interface portproxy delete v4tov4 listenport=8081 listenaddress=127.0.0.1" | out-null A work around is to use the following script. Sometimes there are problems with the network forwarding. So the app can connect to the metro bundler from the emulator via Windows localhost. Windows 10 version 2004 brings network forwarding from The metro bundler is running in WSL2, listening on port 8081. Socat relays the requests from wsl2 to windows using the following command: socat -d -d TCP-LISTEN:5037,reuseaddr,fork TCP:$(cat /etc/nf | tail -n1 | cut -d " " -f 2):5037Įnable access to metro bundler from Windows One solution is to use socat (thanks to the environment variable if necessary. Somtimes adb crashes using the environment variable config. Set environment variable to access adb server, WSL_HOST is ip of vEthernet (WSL) interface in windows export WSL_HOST=$(tail -1 /etc/nf | cut -d' ' -f2)Įxport ADB_SERVER_SOCKET=tcp:$WSL_HOST:5037 The vEthernet (Wsl) adapter belongs to the public profile Enable access to adb server from WSL2

With Windows Defender Firewall allowing access for the public profile, because Start adb server in Windows adb kill-serverĬhange firewall rule for adb.exe on first usage in Defender Popup or Nexus_5X_API_29) in windows "C:\Program Files (x86)\Android\android-sdk\emulator\emulator.exe" -avd Nexus_5X_API_29 Nexus_5X_API_29) in windows with Android Virtual Device Manager from Android Studio. To debug on a virtual device create a virtual device (e.g. To debug on a hardware device connect to android device via usbip from WSL2 (thanks to Connect USB device to WSLĬonnect to android virtual device in Windows PATH=$PATH:$ANDROID_SDK_ROOT/platform-toolsĮxport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64Ĭonnect to android hardware device from WSL2 bash_profile export ANDROID_HOME=/home/xxx/Android/cmdline-tools/latestĮxport ANDROID_SDK_ROOT=/home/xxx/Android

