27

I am trying to follow the instructions here, but my phone never displays the "Authorize USB Debugging" option.

On the PC side, adb devices shows that the PC see the device, but it is listed as "offline" and I cannot use adb shell to talk to it.

Moreoever, if I unplug the device, adb devices does not list it at all, so I assume that the adb server is able to see the phone and simply cannot talk to it.

How can I force the "Allow USB Debugging" to appear on the phone?

I have already tried restarting both devices and disabling and enabling USB debugging on the phone.

3
  • 1
    @Firelord, Yes, I tried three machines but they were all Linux. Haven't tried Windows or Mac.
    – merlin2011
    Mar 11, 2015 at 19:10
  • You might have a faulty cable or one that isn't a data cable.
    – Huey
    Oct 11, 2015 at 3:51
  • It seems like turning off AutoPlay can help on Windows.
    – SamB
    Sep 27, 2020 at 6:25

13 Answers 13

28

I have had this happen multiple times on multiple Android devices. Solved every time by putting the device in Photo transfer (PTP) mode.

ADB will not work for me when my device is in MTP or any other mode.

6
  • This should be accepted answer. Same issue I had with Nexus 6P, which I could debug with no issues on Win10, but on Ubuntu 18 did not popup "Allow USB Debugging" dialog box. I've found this answer, tried it and worked out like a charm.
    – Siniša
    Aug 12, 2018 at 1:23
  • MTP was selected for me. Switched to PTP and worked. Thank you.
    – user25780
    Oct 3, 2018 at 10:22
  • My device only shows up in Chrome's remove debugging when "Install Driver" is selected, but disappears for MTP or PTP. Still will not currently ask for authorization. Nov 2, 2018 at 16:40
  • My Nexus 5x somehow switched to "charging" mode after accepting usb debugging. Setting it back to MTP fixed it for me.
    – frodo2975
    Jun 17, 2019 at 18:27
  • This should be the accepted answer. This problem still occurs in 2019 on a Oneplus 6 / Android 9, and the solution is the only thing that worked.
    – aoeu
    Jun 24, 2019 at 0:53
12

My SAMSUNG Galaxy S4 sometimes bothers me with this annoying offline status message too. I always fix it by trying options below:

  • Try to revoke the USB Debugging authorization on Developer Options menu.
  • Try using adb kill-server and the adb usb commands.
  • Try to replug your device if none of above works.
  • Try Restarting your device.
  • Turn USB Debugging OFF and ON again.
  • Try to Turn Developer Options OFF and ON again.

hope it hepls.

5
  • I was just providing general solutions for others didn't try them :)
    – Sdghasemi
    Mar 11, 2015 at 11:59
  • 4
    Idea 2 (kill-server, then usb) worked for me on my S6 when nothing else would! Thank you!
    – Jon
    May 17, 2018 at 0:46
  • BTW, I also had my phone in PTP mode (Due to Chuck's answer below), not MTP. Not sure if that's related, but if none of these options work for you in MTP try switching it into PTP and trying again.
    – Jon
    May 17, 2018 at 21:08
  • Using 'adb usb' is something new I never did when I got this issue :D Thank you, it worked this time ;)
    – Angusiasty
    Mar 25, 2019 at 16:20
  • adb kill-server and then sudo adb start-server made it show up for me.
    – Pieter
    Aug 30, 2019 at 22:22
8

I am not sure if you ever solved this problem, but I ran into this problem, and tried out many many different procedures, each of which might have helped others, but this is 2016 and a summary might help.

A brand new phone bought in 2016 didn't work when I installed Android Studio on Linux. A phone bought in 2015 worked without a problem. A new phone didn't work with the exact same configuration.

When I have Android Studio open, the AVD manager didn't show the new phone, but showed the old one. The old phone, when connected on the USB plug, threw a dialog asking me to confirm the fingerprint of the RSA key, but the new phone didn't show the same dialog when connected.

I found a tip at https://stackoverflow.com/questions/18011685/cant-connect-nexus-4-to-adb-unauthorized and tried it out and it worked for me.

I removed two files adbkey and adbkey.pub from ~/.android. Apparently android-studio detects this and creates the keys immediately. As soon as this occurs, the new phone threw the dialog open and started working. I am able to see the phone on the Android-Studio's AVD menu and start running the applications.

adb version 1.0.31, BUT, if I try to run 'adb devices' on the command line, Android-Studio stops showing this phone on the AVD menu.

I still don't see the phone (but that does not bother me as I am able to see the phone from the AVD menu). adb command line utility only showed an emulator that was running, but not the phone connected in debugging mode, one that was seen on the AVD menu, up until the command was run.

$ adb devices
adb server is out of date.  killing...
* daemon started successfully *
List of devices attached 
emulator-5554   device

At this point, reconnecting the phone does not help. AVD menu only showed the emulator that was still running on my computer.

You have to run 'adb kill-server'. Once that is done, and if you open up the AVD menu, Android Studio initializes its own ADB and the phone shows up on the AVD menu.

adb version 1.0.31 Android Studio 2.1

So in summary: two things.

  1. Delete adbkey and adbkey.pub from ~/.android while Android Studio is open.
  2. Do not run command line utility adb. It messes with the server instance run by Android Studio. The server instance from commandline works for some phones but not all. Android-Studio works with all the phones I have.

All the above is of course after making sure:

  • you tap the 'build number' thing 7 times and enabling the USB debugging mode...
  • tried 'revoking the debug permissions' many times
  • tried rebooting the phone a few times
  • enable/disable/enable usb debugging mode,

All the above steps seemed like voodoo things to try, but essentially they didn't work, except the ones I listed above.

(Update: Adding this line that was originally a comment, but belongs in the answer).

I also had to add the new phone's vendor ID to /etc/udev/rules.d/51-android.rules file to help identify the new phone and to set the permissions.

1
  • removing ~/.android completely worked for me
    – Tek
    Aug 7, 2018 at 8:16
3

I just had this happen to me. Debugging was working fine at the office, but broken at home.

Turned out to be my usb cable. Everytime I plugged it in, it would charge but I never received the Allow USB Debugging prompt.

I tried a second cable, same thing.

Third cable was the charm, worked fine with a better cable.

0
1

I required "Default USB configuration" to be set to "MIDI"

Windows 10, current as of 24 June 2019. Samsung Galaxy S8 plus.

After 6 months of trying random things and being frustrated I figured it out today!

Of course I had done the obviously necessary steps:

a. On the phone, enable USB Debugging through Developer Options: https://stackoverflow.com/questions/18103117/how-to-enable-usb-debugging-in-android

b. On the computer, install the appropriate "OEM USB driver" for your phone manufacturer: https://developer.android.com/studio/run/oem-usb.html#Drivers

I did those a long time ago, but only recently managed to get the following two things right:

1. Important to choose the right USB cable

A cable might work wonderfully for charging your phone from your laptop, but not work for data transfer (because different pins are used for these purposes). An easy way to check that you have the right cable, set your phone's "Default USB Configuration" in Developer Settings to "Transferring files".

You should be able to see your phone and its contents in Windows File Explorer.

2. Set your phone's "Default USB Configuration" to "MIDI"

Over the last few months' annoyance, I never tried this. Why the hell would that be right?! Today by chance I tried it. I got the "Allow USB debugging?" prompt rather than the "Allow access to phone data?" that we get when connecting with the other USB configurations.

On the Chrome Dev Tools "Remote Devices" panel, within 1 or 2 seconds the phone shows up. Hooray!

This is reproducible, i.e. when you keep computer and phone connected, and flick between the settings of "Default USB configuration", the phone appears and disappears from Chrome Dev Tools Remote Devices, within a second or two. Only appears when phone is set to "MIDI".

On the Chrome Dev Tools "Remote Devices" panel, within 1 or 2 seconds the phone shows up. Hooray!

[edit] 3. You might have to set it away from MIDI and then back to MIDI

I have found a few times that it stops working inexplicably, but it can be fixed by going to Developer Options, setting to something other than MIDI, waiting for the "pling plong" sound from your Windows computer, and then set it back to MIDI.

1

If it shows Unauthorized but if you do not see the RSA prompt on the phone, do the following.

Linux

which adb

Windows

where adb

Identify all the duplicate entries in the path. Remove duplicates.

Now do

adb kill-server 
adb start-server
0

I had to delete the adbkey from /data/misc/adb on the phone and then

In adb shell type > adb kill-server In adb shell type > adb start-server

Now connecting the USB cable brought back the options. For some strange reason I revoked the authorization and been spending hours to get it back..

Thanks..

0

I've had the same issue and it turned out that having the USB mode set to file transfer instead of charging caused my issue. As soon as I set it to charging mode, it fixed my problem and I was prompted for debugging.

0

My problem came down to that I did not have the ADB (Android Debug Bridge) installed on my computer.

I followed the instructions here, and actually downloaded it here. Once I installed the ADB onto my computer, I ran the commands: adb kill-server and then adb start-server.

After doing all this, my root finally worked! I'm not sure if the adb steps are necessary, but I went ahead and performed them. Then when I reconnected my phone, the dialog for giving my computer permissions actually popped up and I was able to root.

0

This answer is for anyone currently facing this horrendously annoying problem (2019+)

Here are some general stuff to try out:

If you've tried and failed for about 5 hours with the above techniques, you can work your way to a custom solution that helped me. Or you can take a look at the question I asked directly.

It seems like the profile of the computer(perhaps the RSA key fingerprint) was automatically recognized by the android device and so it didn't ask for any permissions. From there, I'm still kind of trying to understand it. But basically, as soon as I reset(factory reset) my computer, it started prompting me for authorization again. I'm sure the factory reset was on the extreme end of options, but it worked in the end.

0

This is what worked for me:

  1. Delete adbkey and adbkey.pub files from ~/.android folder
  2. run adb kill-server
  3. run adb usb
0

Dont't forget to install adb for this to work.

For Debian/Ubuntu it's as simple as:

sudo apt install adb
0

Try to install Android USB Driver for your OS. Here is the Samsung one for Windows machines:

https://developer.samsung.com/mobile/android-usb-driver.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .