Distributed android development environment

Local client setup

udev rules

ADB looks for /dev/android_adb device to manage it. Let's help udev to setup this device automatically on every connect.

Connect your android device and inspect /var/log/messages about connection data:

Sep 29 14:34:15 ovws kernel: [21318.486064] usb 1-5: New USB device found, idVendor=04e8, idProduct=6860
Sep 29 14:34:15 ovws kernel: [21318.486072] usb 1-5: New USB device strings: Mfr=2, Product=3, SerialNumber=4
Sep 29 14:34:15 ovws kernel: [21318.486077] usb 1-5: Product: SAMSUNG_Android
Sep 29 14:34:15 ovws kernel: [21318.486081] usb 1-5: Manufacturer: SAMSUNG
Sep 29 14:34:15 ovws kernel: [21318.486084] usb 1-5: SerialNumber: 0019a6fc5fb23f

You can use udevadm to choose any suitable attribute to identify your phone:

# udevadm info --attribute-walk --path=/sys/bus/usb/devices/1-5
.....
    ATTR{manufacturer}=="SAMSUNG"                               
    ATTR{product}=="SAMSUNG_Android"                            
    ATTR{serial}=="0019a6fc5fb23f"                              
.....

Create new udev rule using any identificator (here is a "serial"):

# cat /etc/udev/rules.d/88-usb.rules
SUBSYSTEM=="usb",ATTRS{serial}=="0019a6fc5fb23f",SYMLINK+="android_adb",MODE="0666"

Reattach your android device and inspect devices present and having correct permissions:

# ll /dev/android_adb /dev/bus/usb/001/006
lrwxrwxrwx. 1 root root     15 Sep 29 15:00 /dev/android_adb -> bus/usb/001/006
crw-rw-rw-. 1 root root 189, 5 Sep 29 15:00 /dev/bus/usb/001/006

Remote ADB setup

Copy adb binary to local client, suitable for its platform. Start adb server and check devices:

$ adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
$ adb devices
List of devices attached
0019a6fc5fb23f  device

Now adb running and listen on port 5037, as it printed out.

SSH tunnel

You can dig in any direction.

From server to client:

adt-server$ ssh -L 5037:localhost:5037 client-with-connected-phone

From client to server:

client$ ssh -R 5037:localhost:5037 adt-server

If you are on Windows somewhere, then PuTTY will tunnel port for you, fi. If both sides are Windows ? Hmmm. Probably two tunnels to third Linux box will help, needs to be checked.

Enjoy

Check if you see device on ADT server side:

adt-server$ adb devices
List of devices attached
0019a6fc5fb23f  device

If this was helpfull, please donate
Updated on Sun Sep 29 16:22:12 IDT 2013 by Oleg Volkov More documentations here