I use adb wireless tcpip connection but every time I connect my device to my router it assigns a new IP address to my android device which requires me to plug my phone again and restart adb in tcpip with the IP address provided, I dont want this to happen every time, I just want to enter the same IP address and put adb connect <ipaddress>:<tcpip_port> and connect to my device.

i tried to use static IP for the network using the mobile but due to some reason this restricted me to use internet(it was connected to the modem but not able to use internet).

More info:

Android 10 MIUI 12 redmi note 7s

i use scrcpy and have created a bat file(.cmd file) which when clicked runs a series of commands to connect to my phone wirelessly using adb and mirror the screen and control it remotely but because my router assigns a different IP ever time i connect my phone i have to edit the bat file.

Even if I type the commands manually without connecting the device with USB cable (adb connect <ipaddress>:<tcpip_port>) it says: unable to connect to <ip addr>:5555: cannot connect to <ip addr>:5555: No connection could be made because the target machine actively refused it. (10061) , then i have to connect it with USB cable and again start the adb in tcpip.

What is the use of adb wireless connection if I have to connect it to pc by USB every time (at the beggining) to make it wireless for that specific time.

  • 1
    This can be a device and/or a router problem. Check the MAC address shown for the phone in the router web UI. If it changes then MAC address randomization is implemented wrong in your device. If not make sure to enable the option to assign always the same IP to the device via DHCP. This option is available in normal routers.
    – Robert
    Apr 19, 2021 at 7:04
  • hostname is whatever name your residential gateway has assigned to your phone ip address (line 3). you can find it in router settings or from nslookup
    – alecxs
    Apr 23, 2021 at 11:04

1 Answer 1


IP address is not the problem here. reason is your phone is unrooted therefore the wireless app is unable to start adbd. so you have to plug in usb cable each time and switch to wireless regardless of IP address. This is fixed in android 11

however, regarding your IP issue you can use hostname instead (it is hard-coded here in %device%)


@echo off
setlocal enabledelayedexpansion

set device=android-6cf1b33d5e54da8d

for /F "delims=[] tokens=2" %%f in ('ping -n 1 -w 1000 -4 !device!') do (
  set client=%%f
  echo %%f | findstr /r /c:"\<[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\>" > NUL 2>&1 && goto connect
echo !device! device not found
goto end
adb connect !client!:5555
scrcpy -s !client!:5555

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .