153

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?

Ivan Bartsov
  • 19,664
  • 7
  • 61
  • 59
orS
  • 1,531
  • 2
  • 9
  • 5

26 Answers26

264

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.

Joe Huang
  • 6,296
  • 7
  • 48
  • 81
  • 1
    Yes 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. – Rob Oct 19 '14 at 14:40
  • 4
    This authorize message never came up for me until I disabled Windows AutoPlay by unchecking "Use AutoPlay" for all media and devices." – user1985189 Oct 22 '14 at 17:42
  • 1. unplug, remove all passed allowed devices, replug, check `remember`, 2. ? 3. profit! –  Dec 04 '15 at 18:52
  • I just had to wait about a minute and the Authorization Box appeared on the device. – Ryan R Jan 07 '16 at 21:36
  • 1
    Also check if `echo %ANDROID_SDK_HOME%` is set to the right path – sritmak Jun 23 '16 at 08:30
  • Thanks that solved the problem: - Unplug the device - Wait until a dialog ask to permitt the computer to access the device – Yoraco Gonzales Nov 12 '16 at 19:57
  • In 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? – Arild Nov 25 '16 at 18:40
57

I solved this problem without deleting any keys. Here's how:

  1. My device was connected to my computer via USB
  2. I made sure Eclipse and android device monitor weren't running.
  3. Typed at the commandline prompt: adb kill-server
  4. Typed at the commandline prompt: adb start-server
  5. After adb was restarted, I got a prompt on my device to authorize which I allowed.
janoulle
  • 1,888
  • 27
  • 29
  • This 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... – Tastybrownies Oct 29 '13 at 15:05
  • Note 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. – Danny Parker Jan 27 '14 at 14:31
  • This 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. – MiloDC Jul 18 '14 at 01:01
  • This 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. – Richard Jones Mar 30 '15 at 01:41
  • My phone can't start it is in a boot loop, I cannot enable USB Debugging, How can i do! – MBX Jul 16 '16 at 16:17
44

С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 by adb 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, not root (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
Community
  • 1
  • 1
Ivan Bartsov
  • 19,664
  • 7
  • 61
  • 59
  • This worked nicely. It seemed to force the windows 7 machine to re-install the driver. – barconr Mar 20 '14 at 15:12
  • Solved it for my Nexus 4. Thanks – Diederik May 07 '14 at 12:27
  • Wow - 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). – Jonathan Sep 24 '14 at 15:16
  • *"[Linux] Make sure everything under ~/.android is owned by you, not root (and upvote this answer)"* - is what fixed it for me. Thanks! – Zoltán Aug 07 '15 at 21:47
  • This should be the accepted answer...! Thanks a lot. – Markon Feb 08 '16 at 11:39
  • Changing to USB connection mode from MTP to Camera worked for me on Samsung Galaxy Xcover 3 – Petter Kjelkenes Apr 13 '16 at 10:25
24

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):

  1. rm /data/misc/adb/adb_keys;
  2. I sent the public key (adbkey.pub in ~/.android/) from my computer to my device via email;
  3. Invoke stop adbd;
  4. cat adbkey.pub >> /data/misc/adb/adb_keys (authorize myself);
  5. start adbd (restart adb with new keys).
Lekensteyn
  • 64,486
  • 22
  • 159
  • 192
Flavio
  • 350
  • 1
  • 5
  • Is "~/.android/" a Linux path? -- Where would we find this on Windows? – BrainSlugs83 Nov 04 '13 at 01:04
  • ... 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 Nov 04 '13 at 01:04
  • Worked 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. – Alejandro Mezcua Jan 13 '14 at 14:59
  • 1
    Only way to do it if you don't have a usb connection for whatever reason. – gnac Feb 16 '14 at 18:44
  • 1
    This method is especially good when you have brick'd your device. – Ian Wong Oct 12 '15 at 22:36
  • My 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: https://stackoverflow.com/a/23231640/1064996 . Just FIY since some people found this solution was close but not quite (like for me). – Vaz Mar 19 '18 at 03:09
17

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.

enter image description here

Accept it and you are good to go!

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
11

1.) Delete ~/.android/adbkey on your desktop machine

2.) Run command "adb kill-server"

3.) Run command "adb start-server"

You should now be prompted to accept debug key.

user1078186
  • 111
  • 4
  • 1
    In 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. – BrainSlugs83 Nov 04 '13 at 01:12
  • I went pretty far down the list of answers, but this solution finally solved it. – Drew Dormann May 29 '15 at 00:25
  • Thanks for sharing. Deleting adbkey file and restarting the adb worked for me. – Sujan Shrestha Feb 02 '16 at 09:13
9

Similar to Flavio's answer (https://stackoverflow.com/a/18542792/1064996), it was something to do with the files in ~/.android (on the host machine, not the phone).

I didn't have ~/.android/adbkey, but I did have ~/.android/debug.keystore and my whole ~/.android directory was owned by root. I removed the keystore file and also changed ownership to me (sudo chown -R $USER ~/.android), killed the adb server and plugged in my phone, and it worked.

It was probably the ownership thing. Make sure you have read/write permissions in ~/.android

Vaz
  • 678
  • 6
  • 16
  • 1
    Thanks for the answer the link -- perfect. Permission problem on ~/.android – dpb Nov 13 '14 at 01:31
  • 1
    you saved me, thank you. Why nobody in the whole internet didn't mentioned permission issue.... – kkost Feb 03 '18 at 17:14
9

Had the same issue. Not sure if these are the same steps for Windows as I'm using an OS X device but you can try:

  1. Reboot your phone into recovery mode.
  2. Connect it to your computer.
  3. Open the terminal and type:

    cd ~/.android
    adb push adbkey.pub /data/misc/adb/adb_keys
    
  4. All done! Just adb shell reboot and feel the power!

kiradotee
  • 1,205
  • 12
  • 20
8

Four easy steps

./adb kill-server ./adb start-server

replug the device, unlock it and accept the new key

Oussama L.
  • 1,842
  • 6
  • 25
  • 31
  • Thanks, 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. – Big Rich Oct 06 '15 at 08:28
8

For my Samsung S3, I had to go into Developer Options on the phone, untick the "USB debugging" checkbox, then re-tick it.

Then the dialog will appear, asking if you want to allow USB Debugging.

Once I'd done this, the "adb devices" command no longer showed "unauthorized" as my device name.

(Several months later..)

Actually, the same was true for connecting my Galaxy Tab S device, and the menu options were in slightly different places with Android 4.4.2:

enter image description here

Mike Gledhill
  • 27,846
  • 7
  • 149
  • 159
7

Here is my version of the steps:

  1. Make sure adb is running
  2. In device go to Settings -> developer options -> Revoke USB debugging authorities
  3. Disconnect device
  4. In adb shell type > adb kill-server
  5. In adb shell type > adb start-server
  6. Connect device

if adb shell shows empty host name, restart device

Vasudev
  • 1,936
  • 19
  • 17
6

Had the same issues getting an authorization token on my Nexus 5 on Windows 8.1. I didn't have the latest adb driver installed - this is visible in device manager. Downloaded the latest ADB USB driver from Google here: http://developer.android.com/sdk/win-usb.html

Updated the driver in device manager, however enable/disable USB debugging and unplugging/plugging USB still did not work. Finally the "adb kill-server" and "adb start-server" mentioned in other answers did the trick once the driver was updated.

Dan
  • 573
  • 6
  • 9
  • This 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. – Kaleb Jan 16 '14 at 17:50
4
  1. Make sure adb is up to date
  2. Make sure you are using the google usb drivers: http://developer.android.com/tools/extras/oem-usb.html
  3. Make sure your ANDROID_SDK_HOME environment variable is set to the correct path
terranmoccasin
  • 453
  • 2
  • 7
  • This 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 as `unauthorized`. – sigmabeta Nov 06 '14 at 16:05
  • This... 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 starting `adb-devices` again. – leewz Jul 14 '15 at 20:56
2

I was not getting the RSA fingerprint pop up on my phone.

I had to delete the C:\Users\<userName>\.android\adbkey and adbkey.pub files and then do kill and restart of adb server.

adb kill-server
adb start-server

I had to stop and restart the debugger and connecting as USB in PTP mode.

Because the RSA authorisation key was getting stored in this path, killing and restarting the adb server didn't help.

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
lakme.1989
  • 163
  • 2
  • 6
1

I reinstalled the usb drivers and ensured that I was not using USB 3.0 port.

I then closed out eclipse and killed and restarted adb.

Was immediately prompted on phone to allow computer access. After accepting I restarted eclipse and now my Galaxy S3 shows up in device Device Manager.

Phlume
  • 3,075
  • 2
  • 19
  • 38
1

For me once I disabled MTP (in Settings>Storage>Menu>MTP) I finally got the RSA prompt

1

If you are on adb over network, try to connect via USB instead or vice versa. This did the trick for me. After accepting it once it always works later on.

JohnyTex
  • 3,323
  • 5
  • 29
  • 52
1

This kind of an old post and in most cases I think the answer that has been upvoted the most will work for people.

In Lollipop on a GPE HTC M8 I was still having problems. The below steps worked for me.

  1. Go to Settings
  2. Tap on Storage
  3. Tap on 3 dots in the top right
  4. Tap on USB Computer Connection
  5. UNCHECK MTP
  6. UNCHECK PTP
  7. Back in your console, type adb devices

Now you should get the RSA popup on your phone.

trh
  • 7,186
  • 2
  • 29
  • 41
0

I was able to solve this one by following the steps listed here:http://forum.xda-developers.com/showthread.php?t=2247471

delete the computers adb key: rm /data/misc/adb/adb_key on device 

(I have no idea if in case of multiple authorized computers the additional keys are in a new line of the file or if they are in new files. I have only 1 computer.)

stop all adb processes "killall adb" in linuxoids and "taskkill /IM adb.exe" in windows or simply the taskmanager in both.

restart the phone

toggle usb debugging off and on

connect

use adb

click authorize
Quint Stoffers
  • 790
  • 8
  • 23
  • didn'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!! – orS Aug 04 '13 at 20:58
  • Had 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 Nov 04 '13 at 00:40
0

I had to re-install my adb driver to snap out of this probelm. I had install "Universal Naked Driver" in an effort to recover my phone. I uninstalled that and re-installed the driver out of the android sdk.

yladsr
  • 43
  • 1
  • 4
0

When I turn off my Comodo Antivirus everything goes back normal. All other solutions suggested here went in vain. Somehow I figured out one solution.

If you are using Comodo Antivirus (Version 6.3/ For other versions search for similar options) the following solution would help you.

Open Comodo > Tasks > Advanced Tasks > Open Advanced Settings > Security Settings > Firewall > Firewall Settings > Advanced : Filter loopback traffic (e.g. 127.x.x.x, ::1)

Uncheck this "Filter loopback traffic" option, which prevents adb from normal working.

Ahamed
  • 39,245
  • 13
  • 40
  • 68
0

Use a different USB cable. Some cables may not have all pins connected or whatnot, and while they work for image transfer, the debugging/adb does not work.

The bottom line: I kid you not. A cable which works for my phone (adb works) does NOT work for my tablet - the device is always offline or unauthorized and tablet pops out no dialog. I tried multiple reboots, settings, I went berserk in the process and cursed the bloody Android. Then accidentally I plugged in the cable which came with the tablet and suddenly it worked. My fascination with Android is definitely gone. What a stupid piece of junk.

Martin Vysny
  • 3,088
  • 28
  • 39
0

It happened for me after my backup software changed the permission to my user directory. I opened it in File Explorer, it prompted me to set permissions and it fixed the issue.

FYI: Android has a special directory under "\User\.android" If you can't access it, it won't prompt you.

Dustin
  • 2,064
  • 1
  • 16
  • 12
0

My resolution was running adb devices from the command prompt, pathed to the adb application. For example C:\Android\platform-tools\adb devices . Running this command returned the following * daemon not running. starting it now on port 5037 * *daemon started successfully *

I then saw the device listed as unauthorized, unplugges the USB, plugged back in and was prompted for the RSA fingerprint.

Brad Martin
  • 5,637
  • 4
  • 28
  • 44
0

I was facing same, issue, I found I was using a simple usb cable which was meant for only charge and not data copy. using good usb cable solved my problem !

Narendra Sisodiya
  • 381
  • 2
  • 5
  • 13
0

Simply re-plugging did the trick for me.... The permissions-dialog didn't show up the first time I plugged in the device, the second time it did and everything is fine now.

Vic Torious
  • 1,757
  • 3
  • 21
  • 24