Android Development: Use WiFi as USB cable to test apps

Nowadays, we often use USB to connect to our device to test our programs. But how about wireless test? It may be more convenient.

The default debug mode in Android is USB debug. We can do some small changes so that we can debug wirelessly. Let’s do it step by step.

  1.  Your should root your device.
  2. Install a SSH app on your device. What I use is ssh/sftp daemon, which is free in Google Play. After running the ssh server on your phone, you can use ssh to log in your device through Wifi.
  3. Use command “ps” to check whether /sbin/adbd/ is running. If it’s running, you can stop it with “stop adbd”.
  4. Execute command “setprop service.adb.tcp.port 5555”. Set the running mode of adbd to TCP. And listening port is 5555.
  5. Run adbd by “start adbd”.
  6. Execute command “netstat”. You can see port 5555 is in states “Listen”.
  7. Go back to your computer. Use command “adb connect IP:5555”. The IP is your device’s IP. If the connection is successful, you can see a message “connected to IP:5555”.
  8. Use “adb devices” to check whether it is connected successfully.

All work is done. Now you can enjoy your wireless debugging!