When I'm using a rooted Android device as ADB host to send adb command "adb devices" to Samsung S4, I received device unauthorized error message. However when I tried adb to Samsung Galaxy Nexus, it is working fine. Can anyone advise how to solve my Samsung S4 problem?
=========================================
# adb devices
List of devices attached
4d00f9169907301b unauthorized
=========================================
Thanks in advance.
Edit:
Found that this problem only happened to Android 4.2.2 and above. The following link explained that Google has implemented some new security features for using adb.
http://nelenkov.blogspot.com/2013/02/secure-usb-debugging-in-android-422.html
Appreciate if anyone can help on this.
Best Solution
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 withstop 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