Tuesday, July 9, 2013

Tired of plugging your phone to the pc everytime you want to develop an android application ??

Are you tired of plugging your phone to your pc when you want to develop/debug your Android applications, okey, want to use wireless perhaps ?? hein ? WIFI ?? héh here is the trick
First of all let us understand how your phone connects to your machine.
To set up a connection to your device you should have :
  • The adb client installed on your machine
  • The adb server installed and running on your machine
  • The adb daemon (adbd) running as a background process on your device
When you start the adb server, it binds to the TCP port 5037 and scans up for devices all the odd-numbered ports in the range 5555 to 5585. The port your daemon on your device is listening to should be in this range.

Back to work, we want to debug our applications using a wireless connection (throwing down the cable to the trash :D ). We will need :
  1. An android device, buy one !
  2. But a rooted device, root it (may be as simple as one click ? )
  3. Install the android terminal emulator on your device, here it is.
  4. Android SDK installed on your machine, need an easy way ? Install the ADT bundle, here.
  5. Nothing more :D
Here we go !
Step 1:
Connect your device and machine in a same (local) wireless network.
Step 2 :
On your device, run the terminal emulator.
Find out the device's ip address, type "iproute" for example :

Then type :
su
setprop service.adb.tcp.port 5555
stop adbd && start adbd



Step 3 :
On your machine, open up a cmd/terminall, and navigate to [android_installation_folder]sdk/platform-tools
and type :
adb connect [the_device's_ip_address]

Congratulations, you can now debug, install, remove, log ... applications and have all adb's services running via WIFI. 
Try the DDMS, it works as if your phone was plugged via the cable :D 
So run eclipse and start developing (on air :D ) 

2 comments: