1. Enable usb debugging in Android. (I am using kitkat)
2. connect phone with usb. In notification you will see: "USb Debugging Connected".
3. Open terminal and run:
adb devices
# you will see devices list
------ start output ------ List of devices attached * daemon not running; starting now at tcp:5037 * daemon started successfully 0123456789ABCDEF device ------ end output ------
4. Then run: (it can take half minutes)
adb tcpip 5555
------ start output ------ restarting in TCP mode port: 5555 ------ end output ------
After showing this message terminal will be active. Active means, terminal is ready to take another command.
Note: if this command is stuck. Run adb kill-server
and try step 4
5. Disconnect USB cable from phone
6. Go to the Settings -> About phone -> Status to view the IP address of your phone.
7. Then run:
adb connect <IP address of your phone>
# suppose I run: "$ adb connect 192.168.0.101"
------ start output ------ connected to 192.168.0.101:5555 ------ end output ------
Note: If it does not work, you can try with port number: adb connect 192.168.0.101:5555
8. Now you check the connected devices, run:
adb devices
------ start output ------ List of devices attached 192.168.0.101:5555 connecting ------ end output ------
Note: if you see connecting like me, try "step 9"
9. In android phone,
- Turn off usb debugging, and then turn on usb debugging. or, turning off and on Developer's Option again from Settings
- Then run:
adb connect <IP address of your device>
- Then run:
adb devices
Now you should see,
------ start output ------ List of devices attached 192.168.0.101:5555 device ------ end output ------
Special Note: Still you need to enable "USB DEBUGGING" to debug over WIFI
10. Now you can run your ionic app in real device
ionic cordova run android -l -c -s --debug --target 192.168.0.101:5555