55

EDIT: I figured out the problem, i think. ADB found out I wasn't on the latest updates (at&t released a stagefright udpate and i didnt know) so ADB didn't let me debug. Everything is fine now.

I have been debugging my app on an AT&T HTC One M8 for about a month. Suddenly today when I plugged in my phone, I didn't get the authorization popup. After an hour of troubleshooting, I found the problem, but not a solution.

This is the error i get in Android Studio 1.3.1:

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.

I googled $ADB_VENDOR_KEYS but to no avail.

Information:

  • Phone: AT&T HTC One M8 running 5.0.1 (API 21)
  • Android Studio version 1.3.1 build 141.2135290
  • JDK Version: 1.8.0_60

How can I get the popup again? I need to debug my app

Owen Pauling
  • 11,349
  • 20
  • 53
  • 64
LonelyIdiot
  • 789
  • 2
  • 6
  • 16
  • 1
    Try going into dev options on your device and clearing the access list. – JohanShogun Aug 21 '15 at 05:51
  • That didn't do anything – LonelyIdiot Aug 21 '15 at 05:55
  • 3
    Orthogonal to the issue, albeit, perhaps the following documentation resource may serve to be of any help, as to explain a meaning of the `ADB_VENDOR_KEYS` environment variable for its applications: _[Secure USB debugging in Android 4.2.2](http://nelenkov.blogspot.com/2013/02/secure-usb-debugging-in-android-422.html)_, by Nikolay Elenkov – Sean Champ Apr 02 '16 at 03:30

7 Answers7

69

In this case what you can do is : Go in developer options on the device Uncheck "USB Debugging" then check it again A confirmation box should then appear

Sam Joshua
  • 310
  • 6
  • 17
DvxWifiScan
  • 691
  • 5
  • 3
33

I tried almost anything but no help...

Every time was just this

➜  ~ adb devices    
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
aeef5e4e    unauthorized

However, I've managed to connect my device!

This is the step-by-step tutorial.

  1. Remove existing adb keys on PC:
$ rm -v .android/adbkey .android/adbkey.pub
  1. Remove existing authorized adb keys on device, the path is /data/misc/adb/adb_keys

  2. Now create a new adb keypair

    adb I 47453 711886 adb_auth_host.cpp:220] generate_key '.android/adbkey'
    adb I 47453 711886 adb_auth_host.cpp:173] Writing public key to '.android/adbkey.pub'
  1. Manually copy from PC .android/adbkey.pub (public key) to Device on path /data/misc/adb/adb_keys

  2. Reboot the device and check adb devices :

➜  ~ adb devices
List of devices attached
aeef5e4e    device

Permissions of /data/misc/adb/adb_keys are (766/-rwxrw-rw-) on my device

ColCh
  • 3,016
  • 3
  • 20
  • 20
  • 4
    how can i "Remove existing authorized adb keys on device" on device which is still unauthorized by adb ? – Bourdier Jonathan Jun 19 '17 at 11:28
  • @BourdierJonathan using terminal app on device, or using "Revoke USB debugging authorization" menu entry under Developer Options – ColCh Jun 20 '17 at 12:51
  • 2
    @ColCh My screen is broken ! – Bourdier Jonathan Jun 21 '17 at 08:13
  • @BourdierJonathan try to reboot in recovery and make those manipulations with phone being in recovery mode – ColCh Jun 22 '17 at 12:01
  • using `scp`/`ssh` is also an option for copying `chmod`ing files (in case you can install SSHelper or anything similar) – frans Aug 04 '18 at 09:25
  • 3
    This is the most reliable solution, you might have to run 'adb shell' as root. – Mr. Fish Nov 15 '18 at 10:21
  • 1
    Just a note, if you want to add multiple PC as authorized to a single device, just append the public keys to `/data/misc/adb/adb_keys` – Santosh Kale Oct 18 '20 at 07:47
  • [Harald](https://stackoverflow.com/users/7761292) posted an [Answer](https://stackoverflow.com/a/66080503) saying "...After this procedure it didn't work at first. But an additional `adb kill-server` helped.Thanks ColCh...you saved my day and possible more in the future." – Scratte Feb 08 '21 at 05:18
  • You're welcome :D Sometimes I google this pesky adb problem, and find my own answer, so it saved also my day – ColCh Feb 08 '21 at 08:48
6

look at this url Android adb devices unauthorized else briefly do the following:

  1. look for adbkey with not extension in the platform-tools/.android and delete this file
  2. look at C:\Users\*username*\.android) and delete adbkey
  3. C:\Windows\System32\config\systemprofile\.android and delete adbkey

You may find it in one of the directories above. Or just search adbkey in the Parent folders above then locate and delete.

Community
  • 1
  • 1
Mlu
  • 61
  • 1
  • 1
    I figured out the problem. ADB found out that I wasn't on the latest updates ( I didn't know AT&T released the stagefright update) so it didn't let me debug – LonelyIdiot Aug 28 '15 at 03:48
6

If you have an AVD, this might help.

Open the AVD Manager from Android Studio. Choose the dropdown in the right most of your device row. Then do Wipe Data. Restart your virtual device, and ADB will work.

Narek Torosyan
  • 99
  • 2
  • 10
subash
  • 3,116
  • 3
  • 18
  • 22
4

I tried every method listed here and in Android adb devices unauthorized

What eventually worked for me was the option just below USB Debugging 'Revoke auths'

Community
  • 1
  • 1
killjoy
  • 940
  • 1
  • 11
  • 16
4

I had the same problem running Ubuntu 18.04. I tried multiple solutions but my device (OnePlus 5T) was always unauthorized.

Solution

  1. Configure udev rules on Ubuntu. To do this, just follow the official documentation: https://developer.android.com/studio/run/device

    The idVendor of my device (OnePlus) is not listed. To get it, just connect your device and use lsusb:

    Bus 003 Device 008: ID 2a70:4ee7

    In this example, 2a70 is the idVendor.

  2. Remove existing adb keys on Ubuntu:

    rm -v ~/.android/adbkey* ~/.android/adbkey ~/.android/adbkey.pub

  3. 'Revoke USB debugging authorizations' on your device configuration (developer options).

  4. Finally, restart the adb server to create a new key:

    sudo adb kill-server sudo adb devices

After that, I got the authorization prompt on my device and I authorized it.

Juan García
  • 1,690
  • 1
  • 15
  • 17
3

Sometimes you just need to recreate new device

IvanM
  • 2,913
  • 2
  • 30
  • 30