Search code examples
androidadbremote-debugging

How to set up ADB for remote machine development and local device deployment


My scenario is this: I telework from home and log into my work machine via Windows Remote Desktop. I use Eclipse as my development environment for Android apps on my work computer.

Using ADB, I would like to be able to deploy apps from my work computer to a device on my home network, for scenarios where the emulator doesn't do the app justice.

I found this post, which discusses a very similar scenario, with the exception of deploying to an emulator running on a local PC, instead of deploying to a local device:

Android: ADB remote emulator access

I'm trying to take the same steps, but figure out how to target a local device on my home Wi-Fi network and tethered to my local home PC, instead of the local emulator.

Right now, I have the remote PC set up to try and connect to my public router IP address on port 5585, but in my router, what IP address/port do I forward this to to connect to the local device?

In the example using the emulator, they forward to the local PC address where the emulator is running and port 5555, and ADB is not running on the local PC. I have configured my router to forward to my device IP address, with the device on Wi-Fi, as well as my local PC IP address where the device is tethered.

However in both scenarios, when I try adb connect <router_IP_address>:5585 on my remote PC, it gives me an error unable to connect to <router_IP_address>:5585:5585. I get the same response when trying to forward to/listen to other ports. I'm not getting any security errors in the router log, so it appears the port forwarding is working.

Questions:

  • What local IP address/port number should I forward to when configuring port forwarding on my local network to connect to the local device using the remote ADB instance?
  • Should I be targeting the local PC IP address that the device is tethered to, or the local device IP address?
  • If I target the local device IP address, what port number should I forward to?
  • Do I need ADB running on my local PC?

Solution

  • I had a similar situation. I work on a remote desktop for development, but my Android device is connected to my local laptop. I wanted to be able to use ADB and the Android plugin in Eclipse on the remote desktop and connect to the device attached to my laptop. After searching on the Internet and not finding anything that really helped, I decided to write a port forwarder that would do the trick. You can find it here.