


Select "Port" then Specific TCP port "5037", then "Allow the connection".Right click on "Inbound Rules" and click "New Rule".Open Windows Defender Firewall and go to Advanced Settings.(1) In WSL, add the following to ~/.bashrc: export WSL_HOST_IP="$(tail -1 /etc/nf | cut -d' ' -f2)"Įxport ADB_SERVER_SOCKET=tcp:$WSL_HOST_IP:5037 Found this work-around in a WSL GitHub issue that worked, adding the steps here with a few extra details: If Android Studio was open in WSL2, close it and then open it again.įinally your device is available to debug!ĪDB over TCP did not work for me.Run adb kill-server in the WSL2 terminal and then run adb connect PHONE_ID:5555. adb will probably fail because of the connection confirmation.You will be prompted to confirm the connection on your phone.In WSL2 terminal, run adb connect PHONE_ID:5555.It will probably be something like 192.168.0.10n. You can do this from Settings -> About phone -> Status -> IP address. You will not see any device yet, but this will start up adb. In Powershell on Windows, run adb tcpip 5555.In Powershell on Windows, run adb devices.Make sure your phone is connected to your PC via USB and then you have set up USB debugging.In my case, I added alias adb='/home/MYUSERNAME/Android/Sdk/platform-tools/adb' to my. You need to make sure that you are using the same version of adb on Windows and Linux, which is why I installed the latest Android Studio on both. In the SDK Manager in Android Studio, make sure you have an SDK installed that supports your phone (I had an older phone that needed an older SDK). Add this path: C:\Users\MYUSERNAME\AppData\Local\Android\Sdk\platform-tools.

Under System variables, look for Path, click Edit, and then New. From File Explorer, right-click on This PC and then choose Advanced system settings, then Environment Variables. Add adb to the environment variables on Windows.Install Android Studio on Windows (to get the SDK, SDK can also be installed another way).Here's what I had to do based on this Medium post.
