I've had to deal with this one a few times and every time I forget what the cause is until I dig deep. So here are the symptoms:
- Every time you reconnect/reboot the device you get the authorization dialog even though you could swear you checked the Always checkbox the last time.
adb shell
gives you the blurb belowadb devices
gives you the other blurb below- You cannot connect via adb while in recovery
- Device is unauthorized and plugging it in won't display the authorization dialog
The adb shell
blurb:
user@PC:~$ adb shell
error: device unauthorized.
This adbd's $ADB_VENDOR_KEYS is not set; try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
The adb devices
blurb:
user@PC:~$ adb devices
List of devices attached
C4F124F1B9A98AE unauthorized
Your udev rules are in place and the codes outputted from lsusb
are present in your /etc/udev/rules.d/51-android.rules
(or the redhat equivalent, if different)
What's happening?
Well, for me, the issue has been what you see below:
Notice how my
adbkey
and the matching public key are owned by root? The first time I've ranadb anything
on this machine has been as root. The fix is easy and you probably already know it:sudo chown user:user ~/.android/adbkey*
This happened to me when moving to a new Mac and copying over Android Studio using a full Time Machine backup. After doing some research (which actually did not lead to the reason) just the reinstall of Android Studio solved the problem.