How to solve ADB device unauthorized in Android ADB host device? How to solve ADB device unauthorized in Android ADB host device? android android

How to solve ADB device unauthorized in Android ADB host device?


  • Get the public key from the client phone (adb host)

    cat /data/.android/adbkey.pub

  • copy the above public key to the target phone's /data/misc/adb/adb_keys location. (you may need to stop the adb daemon first with stop adbd)

    cat /data/misc/adb/adb_keys

verify both cat outputs match.

try restarting adb daemon on target start adbd or just reboot them.

If you are having problems reading or writing to ADB KEYS in above steps, try setting environment variable ADB_KEYS_PATH with a temporary path (eg: /data/local/tmp). Refer to that link it goes into more details

    "On the host, the user public/private key pair is automatically generated,    if it does not exist, when the adb daemon starts and is stored in    $HOME/.android/adb_key(.pub) or in $ANDROID_SDK_HOME on windows. If needed,    the ADB_KEYS_PATH env variable may be set to a :-separated (; under    Windows) list of private keys, e.g. company-wide or vendor keys.    On the device, vendors public keys are installed at build time in    /adb_keys. User-installed keys are stored in /data/misc/adb/adb_keys"


Check and uncheck the USB Debugging option in the device.If that doesn't work unplug and plug in the USB a couple of times.

At some point, the device should show a message box to ask you to authorize the computer. Click yes and then the device will be authorized.


If anyone has similar issue of having a phone with a cracked screen and has a need to access adb:

  1. Root your phone (mine was already rooted, so I was blessed at least with that).

If you forgot to enable developers mode and your adb isn't running, then do the following:

  1. Reboot your phone into recovery.
  2. Connect the phone with a cable.
  3. Open terminal.
  4. If you type adb devices you should see the device in the list.
  5. If so, type:

    adb shell mount /systemabd shellecho "persist.service.adb.enable=1" >> default.prop echo "persist.service.debuggable=1" >> default.propecho "persist.sys.usb.config=mtp,adb" >> default.propecho "persist.service.adb.enable=1" >> /system/build.prop echo "persist.service.debuggable=1" >> /system/build.propecho "persist.sys.usb.config=mtp,adb" >> /system/build.prop

Now if you are going to reboot into your phone android will tell you "oh your adb is working but please tap on this OK button, so we can trust your PC". And obviously if we can't tap on the phone stay in the recovery mode and do the following (assuming you are not in the adb shell mode, if so first type exit):

cd ~/.androidadb push adbkey.pub /data/misc/adb/adb_keys
  1. Hurray, it all should be hunky-dory now! Just reboot the phone and you should be able to access adb when the phone is running:

    adb shell reboot

P.S. Was using OS X and Moto X Style that's with the cracked screen.