How to fix adb devices message unauthorized device on macOS
You want to run and test an app on a real hardware device? But what if your device is not showing when you connect your android mobile using USB Cable? What can you do if your device is not displayed on the target drop-down menu in the toolbar of Android Studio? How to fix „adb devices“ shows „unauthorized“ device?
With Android Studio for Mac you can use an Android device for testing and debugging over an Android Debug Bridge (ADB) connection. Therefore you have to enable USB debugging under Settings > Developer options.
What can you do if your device is not displayed on the target drop-down menu in the toolbar of Android Studio?
Go to the directory /Users/[your_user]/Library/Android/sdk/platform-tools with „cd /Users/ridvan/Library/Android/sdk/platform-tools“ Run the command „./adb devices„. If the result shows an unauthorized device:
Disconnect USB connection between Mac/MacBook and Android device. Stop adb server by running „./adb kill-server“ in command window On device use „Revoke USB debugging authorizations“ in „Developer Options“
On Mac/MacBook delete „adbkey“ file in directory „~/.android/“ by running the commands „cd ~/.android/„ „rm -rf adbkey„
Reconnect the device to the Mac/MacBook Open a command window and enter „./adb devices„. Watch the device’s screen for any Authorization message and allow the connection. The device should now show as „device“.