Enabling Persistent ADB Over Wi Fi on Boot
π§Ό Enabling Persistent ADB Over Wi-Fi on Boot (Magisk Rooted Devices)¶
For Android 10+ devices using system-as-root, modifying /system directly is discouraged. Instead, use Magisk's service.d directory to run a custom script at every boot.
β Prerequisites¶
- Your phone must be rooted with Magisk.
- ADB must already be functional via USB initially.
- You must know your device's local IP (e.g.,
192.168.1.42).
π οΈ Steps¶
1. Open a root shell via ADB or a terminal emulator:¶
su
2. Create the Magisk service boot script:¶
mkdir -p /data/adb/service.d
echo -e '#!/system/bin/sh\nsetprop service.adb.tcp.port 5555\nstop adbd\nstart adbd' > /data/adb/service.d/adb_wifi.sh
chmod +x /data/adb/service.d/adb_wifi.sh
3. Reboot the device:¶
reboot
π After Reboot¶
From your computer:
adb connect <your_phone_ip>:5555
Replace <your_phone_ip> with your actual IP (e.g., 192.168.1.42).
π‘ Notes¶
-
This enables ADB over Wi-Fi automatically after every reboot.
-
You can verify it's working by running:
adb devices
and checking for the IP-based device entry.
- To stop ADB over Wi-Fi (optional):
setprop service.adb.tcp.port -1
stop adbd
start adbd