有没有办法从主机连接到仿真器?

发布于 2025-01-23 08:53:53 字数 510 浏览 2 评论 0原文

在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

作妖 2025-01-30 08:53:53

好吧,我想连接从主机操作系统到仿真器。
玩了一下之后,我自己发现了它,对于其他有类似问题的人来说,可能是一个想法。

编辑:在模拟器上使用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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文