有没有办法从主机连接到仿真器?
在MacOS上使用Android Studio工作正常,但是我找不到任何访问模拟器网络的方法。 它似乎使用硬编码的IP地址10.0.2.2,该IP地址不可配置,该用户不符合我的计算机所在的192.168.xx子网。 我尝试了“ redir”,它可以从笨拙的telnet会话中运行,该会话只能在openinh telnet localhost 5554
时每次工作一次。 我在几页上发现,在模拟器的设置屏幕上有一个代理页面。它应该像以下页面:您如何连接Localhost Android模拟器?,但我在设置屏幕中找不到有关代理的任何信息。 模拟器忽略了使用CMD / CTRL的笨拙的ADB调用和击键可以通过笨拙的ADB调用和击键来应对和粘贴模拟器的应对和粘贴。因此,与模拟器的任何沟通几乎是不可能的。 我想念什么吗?
Using Android Studio on macOS works fine, but I cannot find any way to access the network of the emulator.
It appears to use a hardcoded IP address 10.0.2.2 which is not user configurable which does not match the 192.168.x.x subnet in which my computer is.
I tried 'redir' which can be run from a clunky Telnet session which only works once and every time when openinh telnet localhost 5554
one has to input a weird auth token, which is very user unfriendly.
And I found on several pages that there is a proxy page in the settings screen of the emulator. It should be like this page: How do you connect localhost in the Android emulator? But I could not find anything about a proxy in the settings screen.
Coping and pasting from/to the emulator is only possible through clunky adb calls and keystrokes using cmd / ctrl are ignored by the emulator. So any communication with the emulator is almost impossible.
Did I miss anything ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我想连接从主机操作系统到仿真器。
玩了一下之后,我自己发现了它,对于其他有类似问题的人来说,可能是一个想法。
编辑:在模拟器上使用Termux我进行了一个反向SSH隧道开始:
ssh -r 43022:localhost:8022 -r 6900:localhost:localhost:5900 [email  procearted]
这使得与我的MacBook成为SSH连接。然后,我从Termux开始
SSHD
在Termux上打开SSH服务器(在端口8022上)。从MacOS终端i开始
ssh -p 43022用户@localhost
然后我有一个连接到仿真器。
我尝试了VNC( https://github.com/bk138/droidvnc-ng ) Localhost:6900也有效。
使用scrcpy( https://github.com/genymobile/scrcpy 我用来控制我的真实现实从计算机上使用的智能手机)也可以使用。无需隧道,可以直接运行OOTB(开箱即用)。在这种情况下,当我控制真实手机时,复制/粘贴和CTRL键像它们一样工作。
子质量也应在窗户下工作。 SSH隧道更适合Applinux(MACOS / Linux)用户。
droidvnc的屏幕截图(显示netguard)
Well I want to connect from host OS to the emulator.
After playing a bit, I found it myself, may be an idea for others who have similar questions.
EDIT: Using Termux on the emulator I made a reverse SSH tunnel starting:
ssh -R 43022:localhost:8022 -R 6900:localhost:5900 [email protected]
This makes an SSH connection to my Macbook. Then I started
sshd
from Termux to open ssh server (on port 8022) on Termux.From macOS terminal I start
ssh -p 43022 user@localhost
Then I have a connection into the emulator.
And I tried VNC (https://github.com/bk138/droidVNC-NG) using localhost:6900 which did work as well.
Using scrcpy (https://github.com/Genymobile/scrcpy, which I use to control my real smartphone from the computer) that works as well. No tunnels needed, works straight OOTB (out-of-the-box). In that case, copy/paste and ctrl keys work as they do when I control my real phone.
Genymotion should work under Windows as well. SSH tunneling is better suited for Applinux (macOS / Linux) users.
Screenshot of droidVNC (showing Netguard)