5

I have two PCs. One runs Ubuntu and another runs Windows. Both have adb installed. I have an emulator on Ubuntu and I want to connect to it from Windows. I thought I could use adb forward but it doesn't work. On Ubuntu, I set up

adb forward tcp:8080 tcp:5555

adb tcpip 5555

Then, in Windows, I tried to connect:

adb connect user@ubuntu-ip-address:8080

But it cannot connect.

PS: I can connect through ssh from Windows to ubuntu and use adb normally.

1
4

Suppose you have PC1 and PC2. According to the official Android Developer documentation, adb forward is not for forwarding a TCP port of the PC1 to another port of the PC2. It's for forwarding a TCP port of PC1 to a TCP port of the Android device.

For your situation, you can use any port forwarding tool like Port Forwarding for Windows.

There is a nice tutorial below copied from hasper.info by Philipp Hasper:

I often use the Android emulator to check my apps with different display configurations and to stress-test them. But the problem is that it is really slow on my development laptop. So I installed the Android emulator on my desktop PC running Windows and connect to it over my LAN. The major advantage is that you can continue using your development machine while a “server” deals with emulating – one could even emulate several devices at once and still continue programming.

The approach in a nutshell: Forward the emulator’s port so that it is accessible in the local network. Then connect the ADB to it.

On your desktop – the “server”:

  1. Store the executable of Trivial Portforward on the desktop system (e.g. directly in C:\trivial_portforward.exe).

  2. Create a virtual device to emulate (HowTo) and name it “EmulatedAndroid”.

  3. Create a batch file:

    <your-android-sdk-path>\tools\emulator -avd EmulatedAndroid &
    echo 'On the development machine: adb kill-server and then: adb connect <desktop-pc-name>:5585'
    C:\trivial_portforward 5585 127.0.0.1 5555
    
  4. If you execute this batch file on your desktop PC, it will open the emulator with the specified virtual device.

Now on your laptop – the “client”:

  1. Now – given that both systems are in the same network – you can connect to the emulator from your laptop by typing in a terminal:

    adb kill-server
    adb connect <desktop-pc-name>:5585
    
  2. Now you can upload apps, access the logcat and execute adb commands on your remote emulator like on any other Android device. And all without performance impairments on your workstation.

  3. If you are experiencing communication losses, increase the emulator timeout in the eclipse settings to maybe 5000 ms (Window → Preferences → Android → DDMS → ADB connection time out (ms)).

1
  • I have noticed using this way, Android debugging doesn't work. it tries to connect to new port which they decide to meet using abd default communication channel. Jul 17 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.