作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在关注本指南 https://medium.com/@pellea/using-adb-with-wsl2-7aebbb070a47到目前为止,WSL2 可以通过 Android Studios -> AVD 管理器看到在 Windows 上运行的模拟器。例如,在 Windows 和 WSL2 上,adb devices
正确显示:
List of devices attached
emulator-5554 device
但是,当我进入我的博览会应用程序并尝试启动 Android 模拟器时,
我收到以下错误消息 :
Couldn't start project on Android: could not connect to TCP port 5554: Connection refused
这是在我尝试以下操作之后:
ADB_SERVER_SOCKET=tcp:<MY IP>:5037
在我的 WSL2 个人资料中 Set-NetFirewallProfile -DisabledInterfaceAliases "vEthernet (WSL)"
$WSL_CLIENT = bash.exe -c "ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'";
$WSL_CLIENT -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
$WSL_CLIENT = $matches[0];
iex "netsh interface portproxy add v4tov4 listenport=5554 listenaddress=127.0.0.1 connectport=5554 connectaddress=$WSL_CLIENT"
端口如下:
netsh interface portproxy show all
Listen on ipv4: Connect to ipv4:
Address Port Address Port
--------------- ---------- --------------- ----------
127.0.0.1 8081 172.25.38.171 8081
0.0.0.0 5037 127.0.0.1 5037
127.0.0.1 5554 172.29.149.0 5554
最佳答案
您是否尝试将端口 5554 映射到 Windows IP? (或本地主机)。 Android 模拟器运行在 Windows 上,而不是 WSL2,因此端口代理应该是从 WSL2 到 Windows,而不是向后。
你已经用其他方式解决了吗?
关于expo - 无法连接到 TCP 端口 : Connection refused when trying to open Expo app on Android Emulator in WSL2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64628712/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!