androidadbbluestacks

ADB Bluestacks - Connect 2 PC


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.


Solution

  • 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 :)