5

I've two PCs, say PC1 and PC2. I've Bluestacks installed in PC1 and I've Android Studio Installed in PC2. So my question is : "Is it possible to connect to the Bluestacks emulator through the ADB installed in PC2 ?" So that I can install the application from PC1 to PC2's bluestacks.

NOTE: PC1 and PC2 are on the same network.

Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
theapache64
  • 10,926
  • 9
  • 65
  • 108

1 Answers1

5

To connect an adb hosted on a remote computer to a Bluestacks running on the local computer, you can try.:

The problem:

Bluestacks listens on the localhost interface only (localhost, 127.0.0.1), it doesn't listen on ex: 192.168.1.4. Based on this, and at first, you cannot connect remotely to Bluestacks using ADB.

The solution:

Internal Port forwarding

How to:

1 - Download trivial_portforward.zip | mirror

2 - On the computer running Bluestacks, run:

trivial_portforward.exe 9999 127.0.0.1 5555
//usage: portforward [port to listen on] [ip of host to connect to] [port to connect to].

3 - On the computer running Eclipse or Android Studio, run:

adb connect 192.168.1.4:9999 
//Connected to 192.168.1.4 9999

(change to the ip of the computer running Bluestacks)

That's it.

Notes:
Make sure the firewall isn't blocking outgoing/incoming connections on both computers.
I've tested deploying an application and it works :)

Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
  • 1
    You could also setup a ssh server on pc2 and use a ssh client on pc1 that sets up a ssh tunnel ... that way you have something works whenever you wish to access a local port on some remote device that you can login to. http://www.techrepublic.com/blog/tr-dojo/set-up-a-free-ssh-server-on-windows-7-with-freesshd/ – Keith John Hutchison Sep 26 '15 at 23:20
  • Do you have any idea about the `Genymotion` ? i mean how can i connect to the Genymotion of one pc from another pc on the same network? @Pedro Labito – theapache64 Sep 29 '15 at 15:21
  • Genymotion isn't working on my computer so I've no way to help you :(, the logic should be the same, give it a try. – Pedro Lobito Sep 29 '15 at 15:22
  • It seems this method is not valid for another ports. I.e: if you install some SSH server on BlueStacks, nothing is found listening on the host machine on port 22 whan issuing `netstat -ano | find "22"`. Tested too with another ports above 1024. – Sopalajo de Arrierez Oct 07 '15 at 22:47
  • If the `ssh server`, or any other server, isn't listening on BlueStacks there's nothing you can do, this has nothing to do with port forward. – Pedro Lobito Oct 08 '15 at 02:26
  • @PedroLobito Now am working in `Ubuntu`, so.. Do you know how to port_forward in ubuntu like we did in windows ? – theapache64 Jul 16 '16 at 05:33
  • Use iptables to forward ports – Pedro Lobito Jul 17 '16 at 02:21