Android adb wireless/WIFI debug Operation timed out - android

I followed steps in this post and tried to connect to my Motorola X Gen 2 for Wifi debugging, on OS X El Cap.
I connected my phone to the laptop with usb cable,
I killed and started server, the server was started successfully, and then in:
./adb devices
I got
List of devices attached
TA44909GA0 device
Then I did
./adb tcpip 5555
And I tried
./adb connect <IP addr of my phone>:5555
both with usb cable connected and disconnected, none of them worked. Both returned error message saying:
unable to connect to ***.***.***.***:5555: Operation timed out
I cannot figure out what is happening here, I tried the Android Studio plugin ADB WIFI, which returned the same message, operation timed out. I restarted everything, tried connecting with a different cable and all, nothing worked.
Does anyone know what's happening here?

Make sure your computer and the android device are using the same wifi network. I had the same issue and fixed it after changing to the same wifi.

So after a huge number of trials, I think the problem is somehow wifi related, I think this feature does not work well with WPA2 (or any kind of?) Enterprise encryption, because I was using my school Wifi, and it turned out to be okay, up and running, for the hotspot I set up with another laptop.

What solved this for me:
disconnect the phone from USB cable
restart the phone
reconnect the phone by USB cable
(meanwhile):
adb kill-server
adb start-server
Then follow the "standard" procedure.

If you are connected on same network and still can't connect then check your IP twice . Sometimes it get changed.
check your IP = phone settings -> About phone -> Status -> IP address

Try increasing the timeout in Android Device Monitor.
From Android Studio: Tools->Android->Android Device Monitor
In Android Device Monitor:
Window->Preferences, Android->DDMS.
In the DDMS window, increase the "ADB Connection Timeout (ms)". It defaults to 5000ms. If your app is particularly large/takes a long time to load, it may go longer than this timeout, so increasing may fix it.

If you are using Mac OS.
Check by clicking on the wifi icon in the toolbar. If there is any warning.
In my case there was a warning saying the wifi is using WPA protocol and its not secure.
I went to my router settings and changes the protocol to WPA2/WPA3 auto.
After that the warning went away and the wireless debugging started working.

Related

error: more than one device/emulator - cant remove unity emulator

Im trying to get debug info through logcat when developing for android. Logcat does not show any info but only an error
error: more than one device/emulator
When i run command
adb devices
i get
List of devices attached
R3CT20DP74P device
emulator-5562 offline
I guess the emulator is preventing my phone from connecting with adb? Im also guessing thats what causing catlog from logging from my phone. Do i remove the emulator -5562 somehow? Ive tried adb kill-server but the emulator reapears.
Ive also tried
adb -s emulator-5562 emu kill
returns:
error: could not connect to TCP port 5562: cannot connect to 127.0.0.1:5562: No connection could be made because the target machine actively refused it. (10061)
Ive tried:
adb.exe -s R3CT20DP74P forward tcp:7201 tcp:7201
which returns
7201
but does nothing else. Emulator is still there.
First of all, there are 2 separate errors that you're getting, and they actually have nothing to do with each other. You'll need to deal with both of them:
error: more than one device/emulator:
you need to run adb kill-server to clear the connected devices, and then restart ADB. It'll auto-connect any devices that are physically connected via USB, but it won't connect any emulators or devices that are connected via wireless debugging
error: could not connect to TCP port: it looks like you're trying to connect via wireless debugging, and it's a bit finicky. It times out after a while, and the device starts rejecting your connection requests. To fix it, you have to physically connect your device to the PC using a USB cable, and as soon as you do that, it should give you a confirmation prompt on the device to allow the USB debugging connection. After you approve that request, you'll need to turn off wireless debugging, and then turn it right back on. It'll generate a new TCP port for you to use, and you will now be able to connect to wireless debugging using that new port

how to test an app without a USB cable which attaches the device to the debugger?

I'm new to android studio and have just made a new app, which uses position sensors.
All is well when the device is usb connected to the debugger. When I unplug the cable, the app runs fine and I can wave the device around, going to a different room etc. .
But when the app is restarted without that cable, it is "waiting for debugger", which is a little annoying at that point.
I have seen this https://developer.android.com/studio/run#changing-variant but that way I need to sign the app, and I fail on that.
Is there a way to run the app without signing it, and without that debugger cable?
To be more precise in view of the two answers that suggested wi-fi connections (which I can't verify at the moment because the box running AS doesn't have wf-fi connection).
I want to test the app even without debugging, and test it by changing location, too. So I would have to set up a wi-fi connection that would connect to AS over really long distances.
Instead I just want to tell the app (or the device): forget about the debugger.
This: https://stackoverflow.com/a/56541740/4142984 solved my problem.
For the first time you must need to connect device to the android adb and after that you can remove it and still get connection to the android adb.
you should install Android Wifi ADB
you need to connect first time your device with cable in usb debug mode and by using this plugin you can connect your device on the wifi after that you can remove the cable from the system and you will get connected your device to the Android Studio
Note : make sure your system and mobile device must be connected with the same wifi network.
1.Download android-sdk-platform-tools
2. Add the path to environment variables
3. Connect your phone to usb cable
4. Connect your phone and computer in same network(WiFi)\
Now in cmd
5.adb tcpip 5555
6. adb connect *your_phone_ip*:5555
Now you can unplug the usb cable.

Android 11 wifi adb error "Unable to start pairing client"

I downloaded the latest platform-tools for windows, then I enabled developer mode on my phone and turned on adb over wifi. However after I enter the command adb pair ipaddr:port I get the error "Failed: Unable to start pairing client" (after entering the code).
adb is working fine over the cable, and wifi adb is working with my watch. Any ideas?
I tried all possible way. Then I click on forget wifi and then again connect to wifi then entered the pair and code again then it starts working
Had the same problem. Turns out the port used for adb pairing changes each time you ask for a pairing code. I didn't update mine, so it didn't work. When I realized that, and typed in the pairing code, everything worked as expected.
In my case I was connected to a VPN on my workstation and that's why I got this message. Disconnecting from the VPN fixed it.
Try pinging the device 2-3 times and then pair. Only this solution worked for me.
For me, it worked after I restarted Android Studio (or the command line).
One solution that worked for me is to try and establish a tcp connection first to the pairing target.
nc -vz <ip_addr>:<pairing_port>
Once this is successful in establishing a connection, proceed with adb pair. I'm not sure why, but this is the only thing that worked for me. Rest all failed.
If you've recently enabled developer mode on your phone, try restarting it. I was receiving the error, "Failed: Unable to start pairing client", then I rebooted my phone and after that I was able to pair.
In my device the IP address given in Wireless debugging screen is 10.1.10.1 which I know is not my local router's IP address. My router uses 192.168.0.xxx addresses. I found my device's IP address by going to advanced section of connected WiFi network and used that when connecting to adb keeping the port same.
so instead of
adb pair 10.1.10.1:<port>
I used
adb pair 192.168.0.xxx:<port>
I was on a guest wifi network that blocked inter device communication. Switching to my main network solved it.
My issue was I had AFwall+ enabled, so some network connections where blocked which should not have been. I don't know which exactly, but disabling the firewall made it pair.
In my case "User Isolation" was enabled on my modem router which prohibited direct communication between connected devices, after I disable it everything worked as expected.
Both devices must be on same network. In my case I was connect to two different networks.
First make sure the computer isn't paired with the device already in Wireless debugging options under "Paired devices". If it is, forget the pairing. Next restart the device. Afterwards when the device boots back up again, re-enable "Wireless debugging". Sometimes (I think) the computer fingerprint expires on the device and adb pair starts failing. The device at this point may re-prompt you asking to allow the computer's fingerprint. After that adb pair should start working again. Finally once it pairs you may need to run adb connect again with the ip and port listed under "IP address & Port" in Wireless debugging options.
for me , I try all way ,close wifi or restart computer or restart phone, failed ,they all failed .
Until I shut down my VPN , it automatically connected, after that, I connect my phone after close the vpn, The connection has never failed

How to fix an adb offline device without connecting to usb

I've got an android device that was previously connecting over tcp, and later on when I tried to connect adb devices said it was offline. Is there a way I can fix this issue without connecting over usb?
I found that if I disconnect/reconnect from wifi, the error goes away! I did this by moving the phone out of range of the router, and back in.

Android ADB can't ALWAYS see the phone device

I have read all the relative threads about ADB not recognizing devices. My case though is different: ADB sometimes "sees" my phone (Samsung Galaxy) and other times NOT. No matter how many times I kill and restart the ADB service or I disconnect and reconnect the device from/to the PC. Quite an unstable situation here. You know, it's one of these things that drives you crazy. That's why I resorted to your help.
Has anyone had this exact problem and resolved it once for all?
More info:
The PC has never a problem recognizing the device.
I try with both the standard SDK adb.exe and the Universal ADB driver adb.exe.
Either of the above have no problem recognizing the emulator.
Couple things.
1) it's a dumb suggestion but sometimes its as simple as this. Did you try more than one cable?
2) If yes, then try this. try as many times as you have to get it connected since u said "ALWAYS" so it does work sometimes. When it does work, open terminal or command line and run the following commands.
(make sure device is connected when you do this AND you are on the same wifi network)
adb tcpip 5555
then disconnect your phone and run the following command:
adb connect YOUR_LOCAL_IP
do this many times, this is wireless adb connection and if this works, its something with ADB or your computer and not the phone.
Let me know if it works. I might have more ideas depending on what result you get
============ EDIT ============
I believe it's offline because it says 8080. I just did the same with my phone and I get the following:
Try this: disconnect phone physically (if connected) and all other devices and make sure by doing: adb disconnect.
then, do adb kill-server
then, on your phone, go to Developer Options and uncheck USB debugging.
then, right underneath that options, there is Revoke USB debugging authorizations options. select and revoke all devices
then, check USB debugging
then, back on your computer, run adb start-server
then, try reconnecting with the steps I said before. make sure port is 5555
when you run the adb connect command, make sure to add the port at the end.
example: adb connect 10.0.0.15:5555
Hope this works.

Categories

Resources