I am using chrome://inspect/?#devices to connect with my android device.
After ~20 minutes my device gets disconnected automatically every single time.
After it gets discontinued my device asks for allowing usb device again. And if I run adb devices on my Mac, I am unable to see my device since it got disconnected.
I wanted to know the why this is happening and is there a fix available for this or not.
Aim: I want to connect my android device at least for 3 hours without interruption.
I have tried this with multiple devices, multiple data cable and multiple physical conditions but I don't think the issue is from hardware side. USB Debugging is on and the connection stays for a few minutes without any issue, everything works fine for some minutes(not fixed but it is around 20 minutes).
Adding images of my android device and macbook after the connection gets disconnected:
If you are facing similar issues then here are the things that you can try:
Try different USB cable(s)
Try different USB ports on your machine(for some people using 2.0 port worked out)
Try the same process, with unchecked 'Discover USB Devices' in chrome://inspect (then Chrome will connect through the ADB server, not directly) ==> This solution worked in my scenario.
Related
I made a program to backup files in android devices. To put it simply, it works in background of Windows like a server and when a defined android device (with its LAN IP) connects to home's WiFi network it looks for specific files in specific folders in device and backups them.
My problem is, for some devices (e.g Samsung Note 4), after a few successful WiFi connections (or a few days later) the device starts to appear offline. To fix this, I need to reset the authorities in device or do the reconnection procedure of my program with USB cable again. I researched the web in-depth but couldn't find a way to make offline devices online automatically.
Most of 'ADB offline' solutions on the web works well, but i need to do this automatically over WiFi within my program.
-ADB kill-server & start-server, not working,
-ADB disconnect & connect, not working too.
Disable your antivirus and then try again or add adb.exe as exception in your antivirus.
We are working on a device which is running on android ICS 4.0.4 and 3.0.35 kernel. The issue we are facing is with device power management and network reach-ability. once device comes up from suspend mode it is not able to ping any ip address say 8.8.8.8 immediately. some times it take a minute or 2 minutes or sometime it becomes unreachable telling buffer space not available/ destination unreachable. but if we ping this device ip from outside it is responding and from device side also it starts getting ping reply from 8.8.8.8 what could be the reason for such behavior? and where could be the problem? we are clueless, the connection is through mobile data i.e. pppd. every thing seems OK in android UI it shows connected and maintains ip also, but not able to ping anybody after resuming from suspend. because of this issue device cannot browse immediately. where could be the problem, in Android? or kernel Power management? or PPP? If anybody have faced such issue and found any solution please help.
The use case is allow android device to go into suspend mode, wait until it goes to deep sleep. wake it manually and ping any ip say 8.8.8.8 from device's android terminal.
Expected
Immediate reply for ping request.
Check whether ttyUSB or ttyACM ports are working proper after suspend/resume
The issue was with modem firmware. ttyUSB* points were use to hang, once the host M/C goes to suspend. After device resume it was not responding to any AT commands. So to prove the modem, we have experimented on ubuntu laptop.
Modem was connected to the ubuntu Laptop then allowed Laptop to go to sleep mode, after that when we resumed the laptop and issued AT commands at ttyUSB* there was no response from the modem.
So the point was clear that issue was with the modem not with our Android device. subsequently modem vendor corrected the issue in new firmware after that device retained its reachability even after host device goes to sleep and wakeup modes.
I have an Android device (with Lollipop image, if important) running in Genymotion 2.4 and connect to it via ADB (version 1.0.32) from another developer PC with Eclipse in local network without connectivity problems. All is fine except for periodical drops of ADB connection (other protocols keep working fine), that is ADB loses the device, and when I try to reconnect it says that device is offline. From my experience, this offline status does basically mean that the receiving end (the device) still thinks it's connected and declines new connection. The only method I know to remedy this problem is to restart the device and then ADB connects to it as expected.
If someone is interested, ADB is not running on the remote host machine with Genymotion - otherwise the remove connections from other PCs would be impossible.
The question: how can I refresh "softly" the virtual device to accept new ADB connection without restarting entire device?
P.S. If I leave the "offline" device for its own for some time (quite a long time, for example, for an hour) it seems refreshes its state without external interaction, so ADB is again able to properly connect to and device is reported as "online". But, it makes no sense to wait so long for this to happen. This is just a new piece of information for consideration.
This may not work for you, but has worked for me in the situation where my device simply goes ADB offline. One of the comments on your question mentions that their emulator typically goes offline when their device sleeps. Mine does the same and also goes offline after long periods of inactivity, despite not actually sleeping. Anyway, my fix is plain and simple:
In terminal, navigate to where you have the SDK installed. Then, navigate to the directory platform-tools within your SDK, and issue the following command:
adb kill-server
After that finishes, type this one:
adb devices
That almost always fixes my problem, and I hope it fixes yours as well. Let me know how that works for you.
If you use MacOS Sierra - there is a known bug in it.
28.11.2016 There is no workaround yet except restarting adb which is suggested in #lustig answer.
Google gonna fix it in Android Studio 2.3. Issues to track 82425, 216214
There is no info about will Apple fix it on their side or not.
I have the following use case:
App is running on phone.
User connects accessory to phone.
Accessory puts phone in accessory mode.
After reconnecting and opening the right USB endpoint, accessory immediately tries to send data to app.
At step 4, I get USB error 7: Transfer error on bulk endpoint: Operation timed out on the accessory. Presumably this happens because the app has not yet opened the InputStream.
What is the correct way to handle this situation?
As you are probably aware, USB is flaky at best so I'd be looking at problems with driver and/or restarting the host machine and phone. This is the only suggestion I have assuming the USB settings are good on device.
This StackOverflow Question has a lot of answers that are things that I'd look at, some are not as obvious like not using a USB3 port.
The solution turned out to be to increase the timeout for USB transfers. I'm using USB4Java, and it has a default timeout of 5 seconds. When the timeout was increased, it turned out that it took 15 seconds for the first transfer to complete. So I set it to 30 seconds.
I have a nexus 7 running CM10.1 . For some reason i cannot reach it from my laptop on the same wifi network. I cannot ping in either direction. In the past i have been only able to ping one way.
Just tried out on my stock htc sensation and havent the same issue. Also the nexus and htc cant reach each other either.
I have had similar problems with other android devices, in the past i was developing an app and i could not establish a socket connection from the android device to my computer. Once i was able to successfully ping the laptop form my device everything worked.
This isn't persisant, in the past i fiddled around they eventually talked but there was no consistant solution at the time, i never got to the root cause.
I have obvsered this on 2 different wifi networks
Not sure what is happening here my understanding of networks isn't this deep.
My first guess (assuming you're using the right IP, no firewall conflicts etc.):
Check the WiFi Sleep Policy in the WiFi-Settings of your device. You should set it to Never and then try to ping it once more.
That's the way you'll find the option on your android device:
Settings -> Wireless & Network Setting -> Wifi Settings -> Press Menu button -> Advanced -> WiFi Sleep Policy