Fixing ADB Failed to Connect Android Device Wirelessly

How to fix common adb "Connection refused" error when trying to connect to an Android device through Wi-Fi connection

When I’m doing Android development, or just want to install something manually, I like when I can connect my Android device using adb from my MacBook.

But one time I experienced an error message.

Let’s assume I already set my Android IP address in my local network to a static IP address like the following.

ANDROID_IP_ADDRESS=192.168.1.16

Then I tried to connect to it using adb to that IP address with port 5555 (default ADB port). I got an error message like the following terminal session:

$ adb connect $ANDROID_IP_ADDRESS:5555
failed to connect to '192.168.1.16:5555': Connection refused

It’s a bit annoying when that happens, because now I had to reach my Android phone. Just for the record, I rarely use my Android device for day-to-day activity. It usually stays close to a wall charger.

So anyway, after I got the Android phone in my hand, all I needed to do was to connect the Android phone using a USB-C cable to my MacBook (or Windows PC if you must).

Once connected, execute adb usb. This will tell adb to detect an Android device through the USB interface.

$ adb usb
restarting in USB mode

Once it’s connected successfully, activate the adb TCP/IP mode with port 5555.

$ adb tcpip 5555
restarting in TCP mode port: 5555

Once that’s done, disconnect your Android from your MacBook. Now try again to connect adb wirelessly.

$ adb connect $ANDROID_IP_ADDRESS:5555
connected to 192.168.1.16:5555

This time, it’ll be connected successfully!

Now you can install apk or do some Android development wirelessly.

Thank you for reading this short article! See you around.

References