adb devices does not show my device every now and

2019-08-04 00:02发布

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

4条回答
祖国的老花朵
2楼-- · 2019-08-04 00:23

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.

查看更多
迷人小祖宗
3楼-- · 2019-08-04 00:39

use in command prompt call adb kill-server and then call adb devices

I hope its useful to you.

查看更多
仙女界的扛把子
4楼-- · 2019-08-04 00:47

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.

查看更多
干净又极端
5楼-- · 2019-08-04 00:49

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.

查看更多
登录 后发表回答