As an Android developer, we are running the app many times a day while developing/ testing in our mobile for instant results.
But we all have faced issues related to USB disconnection. Sometimes broken / loose / non-functional cables ruin our whole development day.
To solve this issue we are going to see how we can connect the Android device over wifi using an IP Address.
Note: Both Android and System must be on the same wifi network, for the first time you need to attach the device using your cable.
Approach
We will use ADB (Android Debug Bridge) tool which is there in Platform-Tools inside the Android SDK.
All the below steps are for the Mac, open the terminal and be ready:
- First we will set the Android SDK path in base_profile file
% echo ‘export ANDROID_HOME=[ANDROID_SDK_PATH]’ >> ~/.bash_profile
2. Now set your Platform-Tools path from SDK location
% echo ‘export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools’ >> ~/.bash_profile
3. Reload base_profile file
% source ~/.bash_profile
4. Set the target device to listen for TCP/ IP connection on port 5555
% adb tcpip 5555
5. Find the IP Address from mobile, many ways are available
5.1 : Open Setting -> Search IP Address -> Click on IP address
5.2 Open Setting -> About Phone -> Scroll till you find IP Address
5.3 Long Press on Wifi -> Click on Gear Icon -> Advance -> IP Address
6. Connect the device using IP Address
% adb connect [IP_ADDRESS]
7. Remove the cable and check the connection type
% adb devices
That’s it, now we can run our Android app wirelessly
I hope you enjoyed reading this article. Please let me know your suggestions and comments.
Thanks for reading…have a good day.