GOODBYE LOST DEVICE / CONNECTION ON ANDROID DEBUG APPS
You need be in the same network, PC and Android device, of course!
Active your "Developer Options" in your Android! Configure on-device developer options | Android Developers
Connect the device via USB and make sure debugging is working;
On CMD (not necessary ADMIN user status), type command: adb tcpip 5555. This makes the device to start listening for connections on port 5555; - you can use another avaliable!
Look up the device IP address with adb shell netcfg or adb shell ifconfig with 6.0 and higher;
You can disconnect the USB now;
type: adb connect <DEVICE_IP_ADDRESS>:5555. This connects to the server we set up on the device on step 2;
Now you have a device over the network with which you can debug as usual.
To switch the server back to the USB mode, run adb usb, which will put the server on your phone back to the USB mode.
If you have more than one device, you can specify the device with the -s option: adb -s <DEVICE_IP_ADDRESS>:5555 usb.
No root required!
To find the IP address of the device: run adb shell and then netcfg. You'll see it there.
To exit of shell, type exit.
To find the IP address while using OSX /MSWindows (too) run the command adb shell ip route. <--- works better!
WARNING: leaving the option enabled is dangerous, anyone in your network can connect to your device in debug, even if you are in data network.
Do it only when connected to a trusted Wi-Fi and remember to disconnect it when done!
Sergei suggested that line 2 should be modified, commenting: "-d option needed to connect to the USB device when the other connection persists (for example, emulator connected or other Wi-Fi device)".
This information may prove valuable to future readers, but I rolled-back to the original version that had received 178 upvotes.
On some device you can do the same thing even if you do not have an USB cable:
It should show the IP address (if not, no problem - your edition can dont show this info)
adb connect <DEVICE_IP_ADDRESS>:5555
Disable the setting when done
If you dont understand, here a summary: TESTED AND REALLY WORKS!
Connect your USB cable between PC and Android smartphone
type the command: adb tcpip <<port_number>> ---> if the port is not accessible, the ADB try another and show to you!
Disconnect your USB cable, it's not usable now!
type the command: adb connect <<ip_address_of_your_device_in_your_wifi_network>>:<<port_number_showed_by_adb_above>>
It's ready!
Now you can deploy your app using your RAD Studio IDE like before when using USB cable!
If you want come back use USB cable type command: adb usb
Dont forget, read above the warning about using this way access your device using a open-network!
On your device, deselect the "Developer Options" to avoid using advanced options like this.
the ADB.exe is in your Platfom SDK Windows folder, in "..\platform-tools\adb.exe"
You can also set an environment variable called ADBHOST with the IP address and adb will attempt to connect to that ip.
Now I am not sure if DDMS can connect to the device over tcpip, but if adb can, and ddms uses adb to connect, it should be possible.
SOURCE: a summary of internet posts include StackOverFlow
hug