For Windows users:
Step 1:
You have to enable Developer options in your Android phone.
You can enable Developer options using this way.
• Open Settings> About> Software Information> More.
• Then tap “Build number” seven times to enable Developer options.
• Go back to Settings menu and now you'll be able to see “Developer options” there.
• Tap it and turn on USB Debugging from the menu on the next screen.
Step 2:
Open cmd and type adb.
if you find that adb is not valid command then you have to add a path to the environment variable.
•First go to you SDK installed folder
Follow this path and this path is just for an example.
D:\softwares\Development\Andoird\SDK\sdk\platform-tools\;
D:\softwares\Development\Andoird\SDK\sdk\tools;
• Now search on windows system advanced setting
•
Open the Environment variable.
then open path and paste the following path
this is an example.
You SDK path is different from mine please use yours. D:\softwares\Development\Andoird\SDK\sdk\platform-tools\;
D:\softwares\Development\Andoird\SDK\sdk\tools;
Step 3:
Open cmd and type adb. if you still see that adb is not valid command then your path has not set properly follow above steps.
Now you can connect your android phone to PC.
Open cmd and type adb devices and you can see your device.
Find you phone ip address.
Type:- adb tcpip 5555
Get the IP address of your phone
adb shell netcfg
Now,
adb connect "IP address of your phone"
Now run your android project and if not see you device then type again adb connect IP address of your phone
For Linux and macOS users:
Step 1: open terminal and install adb using
sudo apt-get install android-tools-adb android-tools-fastboot
Connect your phone via USB cable to PC.
Type following command in terminal
adb tcpip 5555
Using adb, connect your android phone ip address.
Remove your phone.