Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save frozenbits/7ee1a99c11916b37ddd200e554186a63 to your computer and use it in GitHub Desktop.
Save frozenbits/7ee1a99c11916b37ddd200e554186a63 to your computer and use it in GitHub Desktop.
ADB: Connecting remotely from another machine

If anything makes its way here, it means that I have scratched my head for hours to find the correct keywords to search for these.

These are assuming you have done port forwarding correctly. On local networks, no port forwarding is necessary.

(Yes, I have wasted hours playing around with netsh with its netsh interface portproxy add v4tov4)

How to start adb server on all interfaces on port 5038 (custom port)

adb -a -P 5038 nodaemon server start

How to start adb server on all interfaces on port 5037 (default port)

adb -a nodaemon server start

How to start adb server on local interfaces on port 5037 (default port)

adb nodaemon server start

How to start adb server normally with daemon (what most guides will tell you)

adb start-server

How to connect to a remote adb server (must be started with adb -a nodaemon server start)

Don't ask me why. But from my experiments, you cannot connect remotely if you are using adb start-server. From what I've seen in netstat via netstat -an | find "5037", seems like adb start-server will only bind the listening address to 127.0.0.1, thus preventing remote connection.

adb -H <host-address> <command>
# Example:
adb -H 10.0.0.1 devices

Big thanks to https://www.paincker.com/adb-remote/. I would've never known about starting an adb server this way without that blog. Funny thing, when I want to archive the page, turns out someone else already beaten me to it by a few years. I'm not the only one scratching my head with this thing. image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment