3

I'm working with adb and android studio on mac.

I've noticed that everytime i leave work and come back in the morning, the adb doesn't find the device who's plugged.

What i've tried so far :

  1. Unplugging the usb both from the laptop and the device, and plug it again - adb still doesn't recognise my device.
  2. Restarting the adb by running 2 commands :

    adb kill-server

    adb start-server

  3. Restarting my mac.

Only the 3rd option worked. However, i don't want to restart my computer every morning, only if i have no other option.

Adb showing no devices : no usb devices

Dus
  • 4,052
  • 5
  • 30
  • 49

2 Answers2

2

For some reason the Mac loses authorization for USB debugging after sleeping. The only solution that I have found to work is the big hammer approach...

$ rm ~/.android/adbkeys ~/.android/adbkeys.pub

Then reconnect your USB cable. There are likely significant downsides to this approach, but it certainly works in the short term until a smarter solution is developed.

jmelvin
  • 555
  • 1
  • 7
  • 15
  • It worked: 1) rm ~/.android/adbkey 2) restart adb 3) unplug and replug the device – Chuck Krutsinger Jul 31 '19 at 00:38
  • the dialog message for the annoying Android File Transfer should be "unauthorised" and not "restart your device"... the "Allow" dialog kept reappearing on the phone but still it wasn't authorised after allowing. removing the _adbkeys_ file worked. I did notice there was a change in the MAC address that the phone was giving access to, does that have anything to do with the problem? – rexxar Jul 30 '20 at 06:21
0

This was not always a problem, it has crept in with the newer releases of Android Studio. Its probably not really a MAC problem, but an Android Studio problem. I don't think you need to reboot the MAC, just restart Android Studio. Make sure it shuts down properly first.