Connect adb shell over Wireless / Wifi / Ethernet / TCP network

NOTE: for below article, replace IP address whereever required with your IP address

If you want to connect your mobile/device over wifi adb and access the shell, by default most of the mobiles will not be able to connect, but if you are actively working with some development platform, it might have adb working properly over network, in both of the scenarios, use below mentioned commands to connect adb over network.

If you are using a android development environment device or a rooted device which allows to do certain experiments, in those adb might be already enabled over network,

1. Check the IP address of the device, for this, make sure you have your device connected to network, then goto Settings -> Network & Internet -> click on connected network interface ( Wifi/Ethernet ) -> Select Again -> This will show the device IP address.

OR you can connect device over USB cable and type,

 $ adb shell 
 $ ifconfig 

Note the IP address and then exit from USB adb and remove USB cable. Now, connect over network using IP address as,

 $ adb connect 192.168.0.104:5555
connected to 192.168.0.104:5555 
 $ adb shell 

Sometimes, you may seen an error as below,

 
$ adb connect 192.168.0.104
unable to connect to 192.168.0.104:5555

For this, we need to restart the TCP port using USB adb as, connect device over USB cable and type

 $ adb tcpip 5555
restarting in TCP mode port: 5555

Now, you will be able to connect over network as,

 $ adb connect 192.168.0.104:5555
connected to 192.168.0.104:5555 

If you have not removed the USB cable, you might seen the same device as two devices as,

 $ adb devices
List of devices attached
B2NGAA8831702707	device
192.168.0.104:5555	device
$ adb -s 192.168.0.104:5555 shell
B2N_sprout:/ $ 
Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply