Can't connect Nexus 4 to adb: unauthorized
Solution 1
I had similar situation. Here is what I did:
Try to check and uncheck the USB Debugging option in the device. (if not working, try to unplug/plug the USB)
At some point, the device should show up a messagebox to ask you if you authorize the computer. After you click yes, the device is then authorized and the connection is hooked.
Solution 2
I solved this problem without deleting any keys. Here's how:
- My device was connected to my computer via USB
- I made sure Eclipse and android device monitor weren't running.
- Typed at the commandline prompt: adb kill-server
- Typed at the commandline prompt: adb start-server
- After adb was restarted, I got a prompt on my device to authorize which I allowed.
Solution 3
Сhange USB connection mode from MTP to Camera (for Nexus 7) or, possibly, to Mass Storage or something else (for other devices). This option is usually under Settings -> Storage
. Then connect the device again, you'll get the authorization dialog.
MTP has been known to interfere with USB debugging -- these two did not work together at all on majority of older devices. Nexus 7 and many newer devices do allow both to work alongside, but this particular issue suggests it's not all that smooth yet.
Bonus -- checklist for when adb
is not behaving well:
-
adb kill-server
followed byadb start-server
-
(on device)
Settings -> Developer Options -> USB Debugging
-- switch off and on - [Windows] Make sure you have the proper driver (your best bet is Universal Adb Driver by Koushik Dutta -- will handle any device)
- [Windows] Try turning off all fancy on-the-fly anti-malware scanners/firewalls
-
[Linux] Make sure you have the proper UDEV rule in
/etc/udev/rules.d/51-android.rules
(again, universal solution: https://github.com/snowdream/51-android) -
[Linux] Make sure everything under
~/.android
is owned by you, notroot
(and upvote this answer) - restart device (yes, surprisingly, this is a valid measure, too)
- (Obviously) replug cable, try different cable, different port, remove any extender cables
Solution 4
I think it has an error when the device tries to display the screen asking for permission, so it does not appear.
This works for me (commands are given in the adb shell
):
rm /data/misc/adb/adb_keys
;- I sent the public key (adbkey.pub in ~/.android/) from my computer to my device via email;
- Invoke
stop adbd
; cat adbkey.pub >> /data/misc/adb/adb_keys
(authorize myself);start adbd
(restart adb with new keys).
Solution 5
After you ensure you have enabled USB debugging unlock your phone and plug it into your machine via USB. You will be then asked to authorize communication with the computer you have connected to. It will also show computers RSA key fingerprint.
Accept it and you are good to go!
Related videos on Youtube
orS
Updated on May 01, 2020Comments
-
orS about 4 years
I have a Nexus 4 with Android 4.3 and I am trying to connect the device to a computer with Windows 7 64bit.
I installed the latest drivers and the latest
adb
version. I think I tried almost everything and I still get the following message:C:\Program Files (x86)\Android\sdk\platform-tools>adb devices List of devices attached 007667324ccb229b unauthorized
What can be the reason for this error?
-
orS almost 11 yearsdidn't work... important thing to mention: i tried to connect the device to other computer with windows xp and it's worked with no problems. so i guess that the problem not lies in the usb cable or the device itself, but, i can't find any reason that the problem lies in the computer... thanks!!
-
Tastybrownies over 10 yearsThis also worked for me. There was a prompt asking me to accept an RSA key. Never used to be this much trouble just a couple of years ago. Someone is messing things up...
-
BrainSlugs83 over 10 yearsHad to use "taskkill /F /IM adb.exe" -- the "/F" is for force. When I tried it without "/F" it told me it could not be terminated and that I had to use "/F".
-
BrainSlugs83 over 10 yearsIs "~/.android/" a Linux path? -- Where would we find this on Windows?
-
BrainSlugs83 over 10 years... Found it, it's under "%HOMEDRIVE%%HOMEPATH%\.Android", which is IMO a really odd place to put things (at least in Windows -- application data should be stored under %AppData%...).
-
BrainSlugs83 over 10 yearsIn addition, I also deleted adbkey.pub from my desktop machine, and /data/misc/adb/adb_key from my android device. -- I did get prompted -- and ADB started working again for a time -- but soon after it dies and goes back into Offline mode, no clue why.
-
Alejandro Mezcua over 10 yearsWorked for me in a Galaxy S4 with which I can not connect with the USB cable. Now I can at least connect to it with adb wirelessly.
-
Kaleb over 10 yearsThis worked for me on Windows 7 after I uninstalled the old driver and selected the "delete driver" checkbox... and then reinstalled the new driver to the device.
-
Danny Parker over 10 yearsNote that after 'adb start-server' you should see '* daemon not running. starting it now on port XXXX ' followed by ' daemon started successfully *' If you don't then the kill-server part didn't work and you may need to kill all instances of adb from your task manager/activity monitor.
-
gnac over 10 yearsOnly way to do it if you don't have a usb connection for whatever reason.
-
barconr about 10 yearsThis worked nicely. It seemed to force the windows 7 machine to re-install the driver.
-
Diederik about 10 yearsSolved it for my Nexus 4. Thanks
-
MiloDC almost 10 yearsThis is the correct answer. Merely un-checking then re-checking the debug option for USB connections did nothing for me, and neither did unplugging then reconnecting the USB cable. After I did adb kill-server then adb start-server then un-checked USB debugging then re-checked USB debugging, it worked.
-
Jonathan over 9 yearsWow - that finally worked! I've been trying for hours to try to get my Nexus 7 to bring up the auth dialog. For future reference, in order to change the USB connection mode, you have to go into Settings, Storage and hit the menu icon button in the top right - talk about obscure! I had neither MTP or Camera checked, but as soon as I checked the Camera option, the dialog came up (with it plugged in of course).
-
Rob over 9 yearsYes I downloaded the USB driver, enabled USB debugging, and had this issue. I had to unplug/replug the S4 in, then I got the 'authorize' prompt within S4. Now adb devices shows "device" and i can run my apps.
-
user1985189 over 9 yearsThis authorize message never came up for me until I disabled Windows AutoPlay by unchecking "Use AutoPlay" for all media and devices."
-
sigmabeta over 9 yearsThis answer should be higher - recent versions of Android Studio force you to move your SDK directory out of the AS installation path. Doing this on Windows without moving the
ANDROID_SDK_HOME
environment variable will result in devices showing asunauthorized
. -
dpb over 9 yearsThanks for the answer the link -- perfect. Permission problem on ~/.android
-
Richard Jones about 9 yearsThis answer solved the problem I was having: my device was authorised but then somehow "forgot". I tried any number of things to fix it, but the "adb kill-server" ended up doing the job.
-
Drew Dormann about 9 yearsI went pretty far down the list of answers, but this solution finally solved it.
-
leewz almost 9 yearsThis... this actually worked. My ANDROID_SDK_HOME was set to
...\Android\sdk
when the folder was at...\Android\android-sdk
. Changing it and opening a new Command Prompt (to use the updated environment variables) got me the popup after startingadb-devices
again. -
Zoltán almost 9 years"[Linux] Make sure everything under ~/.android is owned by you, not root (and upvote this answer)" - is what fixed it for me. Thanks!
-
Big Rich over 8 yearsThanks, this was the most simple way, I ran
adb kill-server && adb start-server
as it's a one-liner. I like this method as my development team also use the android device, and reseting the developer option, as suggested elsewhere, might be an inconvenience for the rest of the team. -
Ian Wong over 8 yearsThis method is especially good when you have brick'd your device.
-
Admin over 8 years1. unplug, remove all passed allowed devices, replug, check
remember
, 2. ? 3. profit! -
Ryan R over 8 yearsI just had to wait about a minute and the Authorization Box appeared on the device.
-
Sujan Shrestha over 8 yearsThanks for sharing. Deleting adbkey file and restarting the adb worked for me.
-
Markon over 8 yearsThis should be the accepted answer...! Thanks a lot.
-
Petter Kjelkenes about 8 yearsChanging to USB connection mode from MTP to Camera worked for me on Samsung Galaxy Xcover 3
-
sritmak almost 8 yearsAlso check if
echo %ANDROID_SDK_HOME%
is set to the right path -
MBX almost 8 yearsMy phone can't start it is in a boot loop, I cannot enable USB Debugging, How can i do!
-
fantaghirocco almost 8 yearsthis should be Community Wiki
-
Deko over 7 yearsYou just ended my 2.5h frustration !!
-
Yoraco Gonzales over 7 yearsThanks that solved the problem: - Unplug the device - Wait until a dialog ask to permitt the computer to access the device
-
Arild over 7 yearsIn my case, the phone screen is black (lights up on interaction, sound on etc, there is just no picture). Is there a way to accomplish this without going through the phone UI?
-
kkost over 6 yearsyou saved me, thank you. Why nobody in the whole internet didn't mentioned permission issue....
-
Vaz about 6 yearsMy solution started similarly but it ended up requiring a simple fix for the unix file permissions in
~/.android
on the host machine (not phone). See my answer if this one didn't quite do it for you: stackoverflow.com/a/23231640/1064996 . Just FIY since some people found this solution was close but not quite (like for me).