My requirement is simple - I wanted to use ADB in wsl2. But there is no USB support in wsl2, so I took help from github issue #4619 and enable access to wsl2 section in Building a react native app in WSL2. Yet nothing works. Following are the steps I took:
- Downloaded sdk platform tools from here for windows. Ran
adb --versionwhich isAndroid Debug Bridge version 1.0.41 - Downloaded the same for linux for wsl and unzipped and checked the version to be the same. (Also made changes to .bashrc to have it point to adb where I unzipped)
- Connected mobile with usb which had the USB and wireless debugging option on.
- Ran
adb devicesin windows to check if I could see my mobile being listed and it was. Then ranadb kill-serverto proceed with the next steps. - Did the same in wsl2 to see if the device is listed or not , but it wasn't. So I ran
adb kill-serverto proceed with the next steps. - Tried #4619 and Building a react native app in WSL2 but to no avail.
Please help.
To access device from WSL, you need to run
adbon Windows and then redirect theadbcommands from WSL to the windowsadbserver.From the guide that you linked:
Attention: do not stop the windows
adbserver!! You need it!!