Files
Obsidian-Main/21.04. Android/ADB tcpip.md

1.6 KiB

Use adb tcpip to enable ADB over network.

Setup Android Device

Connect Device via USB

Connect Android device to a PC via USB, and make sure ADB recognize your device.

$ adb devices
List of devices attached
0123456789ABCDEF        device

Enable network of ADB

Use below command to enable network of ADB:

adb tcpip 5555

Get IP of Device

We have to get IP of Device, because another PC need this for connection.

If you connect your device to router with ethernet, pass eth0 to below command to get IP address of device.

adb shell "ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}'"

If you connect your device to router with WIFI, change eth0 to wlan0, like:

adb shell "ifconfig wlan0 | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}'"

Above command will return IP address of eth0, like: !20250115_100240_WindowsTerminal_1305x87.png

Remember your IP address.

Setup PC

Now we have to setup our PC that in the same network with our Android device. Please note this PC doesn't connect to your Android device via USB. So we have to enable connection between PC and your Android devicem, and we need IP address of Android device, you had this at step ADB tcpip#Get IP of Device.

Pass your IP of Android device to below command to enable connection of ADB:

adb connect 192.168.1.108:5555

Remember to change 192.168.1.108 to your really IP address.

Now we can use adb devices to check if we can recognize Android device by IP adress: !20250115_101133_WindowsTerminal_496x107.png