77

I cannot use adb connect to connect via WiFi to my device (Nexus 5, Android 6), but since I'm developing a cordova plugin using USB OTG, I really need to connect via WiFi.

I tried to adb kill-server, and all solutions provided on SO, and none is working for me... Before it was working ok (i.e android 5).

Any idea?

auspicious99
  • 3,902
  • 1
  • 44
  • 58
xavier.seignard
  • 11,254
  • 13
  • 51
  • 75
  • 3
    Your android device might have use another IP address. Double check it, and verify your adb is in tcpip mode `adb tcpip 5555` – Simon Marquis Nov 01 '15 at 22:36
  • no, you can imagine everything is double checked – xavier.seignard Nov 02 '15 at 06:21
  • In what state is your device's adb? Try to kill it (plug in usb or use a terminal app) – Simon Marquis Nov 02 '15 at 09:54
  • I'm not sure if it is a different issue... I have also problems with adb on Android 6 but not having problems with Android 5 and before. Maybe there were major changes in the adb functionality on Android 6 . See also http://stackoverflow.com/questions/33449039/where-is-adb-in-android-6-is-it-removed – user4500 Nov 02 '15 at 12:47
  • 1
    What are you using to make your phone listen for adb connections? – Nanoc Nov 10 '15 at 11:43
  • 2
    Try different port, e.g.: `adb kill-server && adb tcpip 5236 && adb connect 192.168.1.10:5236`. Make sure the IP address is correct, and your computer and the target device are on the same network. – ozbek Nov 11 '15 at 12:24
  • Thx ozbek I obviously already tried it – xavier.seignard Nov 11 '15 at 16:11

22 Answers22

173

I had the same issue since the android 6 upgrading. I noticed that for some reason the device is playing "hard to get" when you try to contact it over WIFI.

Try these following steps:

  1. Make sure that Aggressive Wi-Fi to Cellular handover under Networking section in the device's developer options is turned off.

  2. ping continuously from your pc to the device to make sure it's not in network idle mode ping -t 192.168.1.10 (windows cmd), unlock the device and even try to surf to some website just to make it get out of the network idle.

  3. If ping doesn't work, turn off / on Android Wifi and go back to step 2.

  4. When it replies to the ping, connect it via usb, and:

    adb usb

    adb tcpip 5555

    adb connect 192.168.10.1:5555

  5. In case it's still not connected, try to switch the USB connection mode as MTP / PTP / Camera while the device is connected through USB and repeat these steps over again...

If the above points are not working please try running ADB as admin. For Ubuntu -

`sudo adb start-server`
HackRx
  • 198
  • 2
  • 14
Eliran Kuta
  • 4,148
  • 3
  • 24
  • 28
  • 1
    Thanks Eliran Kuta The ping stuff did the trick! Weird issue though. – xavier.seignard Nov 12 '15 at 22:59
  • I made restart to the phone - and then the ping helped me. thanks. – STF Jan 09 '18 at 09:07
  • 2
    step 4 was critical to solve the issue. I never tough that switching from MEDIA to Camera will solve the issue. but it did! – dsncode Apr 15 '18 at 07:45
  • awesome!!! Had the same problem, just surfed a short while with my Samsung Galaxy, tried again - ping worked and tried to connect - voila :-) – Björn Hallström Jun 04 '18 at 12:54
  • sudo adb start-server – Dipendra Sharma Jan 09 '19 at 05:33
  • Although it says ping: invalid argument: '192.168.1.3', the next commands worked just fine. Thank you! – Tamim Attafi Mar 09 '20 at 06:44
  • Rebooting the router helped me – Georgiy Chebotarev Jul 29 '20 at 08:46
  • `adb usb` resulted in `error: no devices/emulators found`, `adb tcpip 5555` resulted in `error: no devices/emulators found `, but doing this using my devices ip and expected port from the adb settings `adb connect 192.168.1.8:5555` on it's own worked for me and even made the device appear in the list of target devices in android studio. i am running android 10 on a raspberry pi 4 connected to my pc over USB C. with the USB port connected from my pi to the USB C port on my PC's mother board. – greg Aug 05 '20 at 06:26
  • `ping ` it worked for me, and now I am able to connect my device wirelessly. Thanks – HackRx Sep 20 '21 at 14:34
  • Only step 4 was enough for me to solve the problem. Thank you! – Christopher Kikoti Jul 24 '22 at 11:12
23

First, you need to pair your computer :

  1. Go to Wireless debugging > Pair device with pairing code.
  2. Go to console of your pc and run adb pair ip:port pairing_code
  3. Now , run adb connect ip:port on your pc and enjoy.
  4. Go to Android Studio and you can the see new device.
Think Big
  • 1,021
  • 14
  • 24
15

I had the same issue. i tried all commands like adb kill-server then adb tcpip 5555 then adb connect <IPAddress>:5555 but the issue remain same

the IP address which i used to connect ... showing me message unable to connect .....

what i did is go to phone's settings

then About phone

then Status`

then check IP address

Now try to connect phone with that IP address

Note : - The problem is the IP address changed which i used to connect

vijay saini
  • 361
  • 3
  • 6
11

I had the same problem. The solution was as follows.

In Developer Options. + Activate "Allow ADB debugging in load only mode." + In Spanish, "Permitir depuración ADB en modo solo carga."

Explanation My problem was as follows: I was doing all the steps:

  • adb kill-server
  • adb start-server
  • adb tcpip 5555
  • adb connect (your ip).

After completing these steps, I disconnected the phone from the USB cable, and the connection was lost, I could not make the wireless connection.

However, this worked for me on a Huawei ALE-23 cell phone, but it did not work for me on the Huawei Y9S cell phone (Android 10), it failed.

I solved it only by activating the option "Allow ADB debugging in load only mode" in the cell Huawei Y9S.

Cheers!!!.

IVAN MANJARREZ
  • 111
  • 1
  • 2
9

Make sure you are not connected to a VPN. I was able to connect to adb as soon as I disconnected from the VPN. For a sure way to connect do this:

  1. Unplug USB
  2. Restart Android device
  3. Shutdown Android Studio or any other IDE using ADB
  4. adb kill-server
  5. Plug back in USB after restart
  6. adb devices This automatically starts the server. You sould see the device plugged in via USB
  7. adb shell ip addr show wlan0 to get your devices IP address
  8. adb tcpip 5555 Set the port to 5555 that you want to connect through
  9. adb connect 192.168.0.6:5555 Replace IP address with one from step 6.
  10. Disconnect the USB
Nick Gallimore
  • 1,222
  • 13
  • 31
  • and if u get `failed to connect to '192.168.1.2:5555': Connection timed out`, switch off wifi on ur mobile and back on and try the connect command again – lordvcs Oct 22 '21 at 07:04
  • Worked like a charm - the only additional thing that I did was to keep the "Troubleshoot device connection issues" tab open on my Android studio while I was trying to connect to the device. All worked well. Thanks a lot. – arun Oct 29 '21 at 00:30
4

I used the same approach as @IVAN MANJARREZ ADB : unable to connect to 192.168.1.10:5555

The only difference was I used Huawei - p20 pro. Where for p20 - pro, you have to search for and activate "Allow ADB debugging in charge only mode"

mladjo
  • 41
  • 1
3

I have tried everything but still, nothing worked for me. Then randomly, I used the following command:

$ adb tcpip 5555

error: no devices/emulators found

$ adb connect 192.168.0.104:5555

failed to connect to 192.168.0.104:5555

$ adb connect 192.168.0.104:5555

already connected to 192.168.0.104:5555

It was connected at this point but my device was offline. I was always able to connect at the second attempt but my device was always offline. At this point, I connected my device to my PC with USB.

$ adb tcpip 5555

error: more than one device/emulator

$ adb disconnect

disconnected everything

$ adb tcpip 5555

restarting in TCP mode port: 5555

$ adb connect 192.168.0.104:5555

connected to 192.168.0.104:5555

I disconnected my USB and voila! my device was still connected. I am sorry but I can't explain why it worked. I was randomly trying different things on internet. I had used the same commands several times but in different orders but they didn't work. I hope it will help someone.

Shunan
  • 3,165
  • 6
  • 28
  • 48
3

I solved this problem by disabling USB debugging and enabling it again

Ramonzito
  • 61
  • 1
  • 4
1

The critical step in getting this to work is disconnecting the usb cable after issuing the adb connect xx.x.x.xx:5555 command. At this point you are connected but unauthorized. Execute adb kill-server and re-issue the connect command. Verify with execution of adb shell date.

  • this worked in my case . Scenario. Had 1 running android 9 ( a9) and other 10 (a10) .I had 2 aliases `root# alias a1 a2 alias a1='adb kill-server && sleep 2 && adb tcpip 5555 && adb connect 192.168.43.1:5555' alias a2='adb -s 192.168.43.1:5555 shell'` . on a9 running a1 and a2 seperately will work but a1 && a2 does not . 50% times it gives me "vendor keys not verified" . On a10 . a1 works. a2 will not . I have to disconnect usb & run a2 without alias per above. I wonder why that happens – user1874594 Mar 17 '22 at 10:17
1

connect using USB and Just use this command

adb tcpip 5555

It will restart services and then adb connect <device-ip>:5555

Note: to find device IP, you can navigate to wifi -> YOUR_NETWORK -> IP address

HackRx
  • 198
  • 2
  • 14
Yogesh Shinde
  • 393
  • 4
  • 11
1

Similar issue happened to me when I tried to connect wirelessly to my phone. I got this error:

failed to connect to 192.168.1.187:42534

I tried to restart everything, phone, PC, adb server. The issue was simply that you have to connect by cable first to authorize the client and then you can unplag the cable and connect wirelessly.

arenaq
  • 2,304
  • 2
  • 24
  • 31
1

I'll add my two cents.

For some devices, you can directly connect by the address and port as specified in the Wireless Debugging section e.g 192.155.230.241:43522

use adb connect <IP:PORT>

If not successful, use adb connect <IP:5555>

If still not successful, it probably means you will have to pair your device to your machine via adb first. This usually comes on some devices with above commands but if not then,

use adb pair <IP:PORT>

On Device > Developer Options > Wireless Debugging > select Pair device with pairing code

Enter this pairing code on console and device will pair.

Now use adb connect <IP:PORT>

Also note, You don't need USB debugging on or any cable connections first and TCPIP configuring with this way.

PrasadW
  • 397
  • 6
  • 19
0

In my case I had to shut of and on the wifi adb debugger app, on the device. On another USB device I had to shitch off and on developer mode, then re-set the development options. Also reset my pc.

Seem that adb in some way made a mess with global communication and all the debug communication have to be reset on both sides.

After this the devices start to comunicate again

Luca C.
  • 11,714
  • 1
  • 86
  • 77
0
sudo adb start-server

Just worked for me. after A day of looking for a solution.

Ian Samz
  • 1,743
  • 20
  • 20
0

So my situation was that i restarted it in tcp mode but still couldn't connect, i had an No route to host error ,so i tried pinging it but i couldn't find it either even though it was on the arp table. so what i noticed was that when i connect it by usb, it pings successfully. so i had to do the adb connect ip before i could unplug the usb.

0

I ran into this same issue on not being able to connect via Wi-Fi but was using the snap version of scrcpy. I kept seeing messages like adb server version (40) doesn't match this client (39); killing... when I would run adb or scrcpy commands but it still worked, until I tried to connect over Wi-Fi.

$ scrcpy 
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
adb server version (40) doesn't match this client (39); killing...
* daemon started successfully
adb: error: failed to get feature set: no devices/emulators found
ERROR: "adb push" returned with value 1

I believe this means it was unable to push the server app to the device.

Running the commands to setup Wi-Fi using the adb built into the snap, scrpy.adb solved this for me.

$ scrcpy.adb tcpip 5555
$ scrcpy.adb connect 192.168.1.25:5555
connected to 192.168.1.25:5555
$ scrcpy
INFO: scrcpy 1.16 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 0.6 MB/s (33622 bytes in 0.051s)
[server] INFO: Device: XXXXX XXXXXXX (Android 9)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 390.25
INFO: Trilinear filtering enabled
INFO: Initial texture: 1440x2560
frederickjh
  • 1,739
  • 1
  • 11
  • 10
0

I faced the same issue with the ADB over WiFi connection between my Android 10 phone and Windows 10 PC, which was OK before and suddenly this happened. After reading this question and answers above, I first turned off WiFi on my router and turned it back on.(I repeat not the router, just WiFi) It worked.

Nuwan Thisara
  • 226
  • 5
  • 15
0

I created this powershell script that automates the connection to the phone, to make it work follow the steps and reassign the variables to make it work on your device

#Important!!!
# Enable developer options on your phone and follow the steps below:
# Step 0: Developer options > (USB debugging = true) and (Permanently accept the digital signature of the computer)
# Step 1: Developer Options > Active Screen = true
# Step 2: Developer options > Allow ADB debugging in load-only mode = true

$customPort = '5555'
$ipPhone = '192.168.1.53'
$fullIpPhone = $ipPhone + ':' + $customPort

Write-Host 
Write-Host '=============Start script============='
adb usb

Write-Host 
Write-Host '=============Start clean network============='
adb devices
adb disconnect
adb kill-server
adb devices

Write-Host 
Write-Host '=============Start connection============='
adb tcpip  $customPort
# adb tcpip 5555 # $customPort
adb connect $fullIpPhone
# adb connect 192.168.1.53:5555 # $fullIpPhone
adb devices

Write-Host 
Write-Host '=============End script============='
Fred
  • 1
  • 1
0

I had the same issue. i tried all commands like adb kill-server then adb tcpip 5555 then adb connect :5555 but the issue remain same

the IP address which i used to connect ... showing me message unable to connect .....

what i did is go to phone's Settings

then About phone

then Status`

then check IP address

Now try to connect phone with that IP address

Note : - The problem is the IP address changed which i used to connect

dukizwe
  • 160
  • 3
  • 9
0

In my case just restarting the device worked. Just try if you are lucky!

Anish Vahora
  • 243
  • 3
  • 10
0

[Dec-2022] I suffered from this problem around 2-3 months.

I tried all the cmd way but my device(Android 12) was not connecting wirelessly. As my laptop & mobile was both connected 5 ghz connection of my router.

After switching my mobile to normal 2.4 ghz wifi network. it connected with adb connect {ip-of-device} !!

So, if your wifi network supports both the 2.4 and 5 ghz then try connecting your devices(laptop/mobile) to another combination. Then try to connect with adb connect {ip-of-device}

Darshan Rathod
  • 591
  • 4
  • 16
0

Ok this might sound silly but make sure you have connected your phone to the computer through usb, and not to the electrical plug! (if you are using two different cables).

Antonin GAVREL
  • 9,682
  • 8
  • 54
  • 81