2

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 ?

user513667
  • 81
  • 1
  • 4

1 Answers1

1

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 macuser@10.0.2.2

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)

user513667
  • 81
  • 1
  • 4