Sometimes when you do adb devices it lists your device , while next moment when you do adb devices it doesn't show my devices.
I am using it for automating a workflow and adb disconnects with my Nexus frequently in between causing it to fail. I am on MAC. I know one solution is to restart adb server or reconnect the device but I cannot use these solutions in between the workflow
Please help
You can try running this on the Terminal
adb kill-server
adb start-server
You need to get the Android debug Bridge (ADB) for that.
I don't understand why you can't restart ADB in workflow?
Could you provide anything you have donw so we can check. If you're doing an automation/tool that use adb commands, you can get the adb status and depending on that value you can do whatever you need to do. Use
adb wait-for-device
If device couldn't be reached after some time, throw an error.
use in command prompt call adb kill-server
and then call adb devices
I hope its useful to you.
If devices are physically connected via USB and adb kill-server
does not help to fix the issue, one possibility is that your device is not properly configured for development. Run “Settings”, and make sure that:
- “Developer options” is ON.
- “USB debugging” is ON.
(Both need to be ON). Now try again to restart adb server.
In the past I used to have a similar issue: Sometimes adb devices
lists my device, but sometimes it does not. When it does not list my device, I have noticed that “USB debugging” has (accidentally) been turned off. Turning it back on has fixed the issue for me. Sure this is only one possibility that may not apply to your case. So it's just one item in your checklist.