diff --git a/20. 專注/Android/ADB tcpip.md b/20. 專注/Android/ADB tcpip.md index e844d72..10e0dc8 100644 --- a/20. 專注/Android/ADB tcpip.md +++ b/20. 專注/Android/ADB tcpip.md @@ -9,8 +9,40 @@ List of devices attached 0123456789ABCDEF device ``` -## Get IP of Device -Use below function to get IP address of device: +## Enable network of ADB +Use below command to enable network of ADB: ```bash -ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}' -``` \ No newline at end of file +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. +```bash +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: +```bash +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|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|400]] diff --git a/attachments/20250115_100240_WindowsTerminal_1305x87.png b/attachments/20250115_100240_WindowsTerminal_1305x87.png new file mode 100644 index 0000000..5a45d55 Binary files /dev/null and b/attachments/20250115_100240_WindowsTerminal_1305x87.png differ diff --git a/attachments/20250115_101133_WindowsTerminal_496x107.png b/attachments/20250115_101133_WindowsTerminal_496x107.png new file mode 100644 index 0000000..88e6169 Binary files /dev/null and b/attachments/20250115_101133_WindowsTerminal_496x107.png differ