Replies: 13 comments 10 replies
-
/dupe #2195 |
Beta Was this translation helpful? Give feedback.
-
Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
Beta Was this translation helpful? Give feedback.
-
TCP bridge. Likely dupe #4619 but having pulled the trigger too fast once already will let it float. |
Beta Was this translation helpful? Give feedback.
-
See #4619 (comment) for a workaround. |
Beta Was this translation helpful? Give feedback.
-
Workaround didn't work for me... |
Beta Was this translation helpful? Give feedback.
-
@gusflopes For me it was windows firewall issue, check your firewall settings, after correcting that it worked. |
Beta Was this translation helpful? Give feedback.
-
Alright so here's what you're gonna do: Add the following to your WSL bashrc or zshrc:
Then create a firewall entry, create a new "Inbound" Rule. Select "Port" then Specific TCP port "5037" then "Allow the connection" then check all of Domain, Private and Public and add a name. After the firewall entry is added, open up its properties, go to Scope -> Remote IP Addresses -> Add "172.16.0.0/12". Now that we're covered in the WSL2 VM and through the Firewall, you have to start the adb server with specific arguments to make it listen on all addresses (don't worry we've only whitelisted our WSL2 VM IP range so no security issues). Create a vbs script, call it whatever and put this in it
Now all you have to do is invoke the vbs script once per reboot and your WSL VM will connect to your host ADB instance |
Beta Was this translation helpful? Give feedback.
-
I was able to connect over wifi without the need of installing on both sides. See - https://developer.android.com/studio/command-line/adb/?gclid=CjwKCAjw2dD7BRASEiwAWCtCbxKzwu63T-HpLaIp8ASO1aNA6aRl7_8Wvc2LqCvf3BI3umOlQQaOtBoCQrEQAvD_BwE&gclsrc=aw.ds#wireless |
Beta Was this translation helpful? Give feedback.
-
This one ("used to work on WSL1 but no longer in WSL2") is #4619. It's analogous X11 Server on Windows, Database server on Windows, etc etc. Rather than dupe, porting over to the discussion forum for tips/tricks ADB over TCP with WSL2. Thanks for the input everyone. |
Beta Was this translation helpful? Give feedback.
-
I was using Intellij''s Android developement setup inside of WSL2. IntelliJ/Android Studio does not let you set the The fix I came up with was to use export WSL_HOST_IP="$(tail -1 /etc/resolv.conf | cut -d' ' -f2)"
socat TCP-LISTEN:5037,reuseaddr,fork TCP:$WSL_HOST_IP:5037 Make sure to run this in a separate process before starting up Intellij/Android Studio, since the IDE will start up an adb server if it detects that one is not yet running. Once it starts up the server, you will not be able to run the above socat command, and it will result in an error of something to the effect of |
Beta Was this translation helpful? Give feedback.
-
Getting I have set those environment variables in WSL
And starting
WSL2 distribution adb Windows adb WSL |
Beta Was this translation helpful? Give feedback.
-
After following some guide, I still cannot connect my WSL2 React Native build to the emulator of my Android Studio in Windows. The run returns me this message: |
Beta Was this translation helpful? Give feedback.
-
After two days of research, here is what helped solve my problem in my case. In my case, the device used port 21503. Therefore, the command looked like: Then run More information here https://learn.microsoft.com/en-us/windows/wsl/networking In fact, for me this was the only option since I couldn't use WSL 1 (which connects to localhost without problems since it is not a VM). |
Beta Was this translation helpful? Give feedback.
-
ADB (Android Debug Bridge) used to work on WSL1 but no longer in WSL2
The catch was to use the same version in both windows and linux
WSL1
WSL2
OS
Beta Was this translation helpful? Give feedback.
All reactions