We are doing automation testing on mobile devices with Appium, but the testing fails because of the popup 'Allow USB debugging?' even though the device is already connected through adb connect and adb devices.

I already checked the 'Always allow from this computer', but still, sometimes it pops up and causes the test to fail, and other times it works just fine; not popping up at all.

How to address this issue?


4 Answers 4


Change the USB cable

My proposed solution is not general, but may work in in some special cases.

Here is my story: Once I used an old USB cable for connecting my 10 smartphones to my computer. It worked well for 9 phones, except for 1 phone where “Allow USB debugging” kept on popping. Then I changed to a newer USB cable, and the problem went away.

  • 1
    I was getting this every few minutes. I switched to a different USB cable and haven't gotten it in a couple of days. We'll see if it lasts but definitely worth a quick shot. Thanks! Commented Oct 28, 2021 at 13:40

In my case, I was continually getting prompted with one fingerprint. I revoked all debugging permissions and next time the dialog popped up, I noticed the fingerprint had changed. So far I haven't been prompted again.

So: try revoking all debug permissions and then allowing USB debugging again.


One possibility for this problem may be located on PC side: May be you are running multiple adb daemons with different private keys. The private key is used for identifying the "this computer".

The relevant files that contain the cryptographic identify are adbkey and adbkey.pub located in the folder .android folder within the user home directory:

  • Windows: C:\users\%username%\.android\
  • Linux: ~/.android/

Make sure those two files don't change. Some other software may overwrite these files.

Another possibility would be a problem on device side that e.g. the adb server crashes and losses the data on previous authorized computers. Or it may be a bug in adb that causes the identification of the computer to fail.

  • 1
    Problem with the USB port or the the cable can also does that. It used to be the case with my Nexus 6 (bad port, bad cable) but this is unlikely the case for OP though.
    – Firelord
    Commented Feb 14, 2019 at 16:55
  • Thank you @Robert for this one. I will sure to check it on my side. But i am using my pc that is connected to the mobile device with a usb cable. Regarding on the another possibility, should i have a checker to check every execution whether the RSA key of the computer is already authorized to the mobile device then add it otherwise?
    – Gel
    Commented Feb 15, 2019 at 3:07
  • Yes @Firelord, I also think that it may be because of the usb cable that caused the loss of connection but I have a checker to execute adb devices to check if there's a connection before executing the test. It says that it is connected but it will fail in creating the mobile capabilities in Appium. So that's what I am wondering about as to why it failed when it says that it is already connected. Then it also prompts the 'Allow usb debugging' even though I already checked the 'Always allow in this computer'
    – Gel
    Commented Feb 15, 2019 at 3:11

Make sure the cable is fully plugged on both ends. On computer side it was a bit loose. It solved the problem.

You must log in to answer this question.

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