I have a VSTS/Azure DevOps self hosted agent running as a service on a machine with an Android device attached via USB that I'd like to use with ADB.
During the build a Command Line task invokes an ADB command. I'm having an issue where the device goes unauthorized when someone logs into the machine. What I observe happening is
This seems similar to RSA fingerprint change every time a new build is started, but their question is for docker/gitlab-ci.
To fix this, you will need to create a system wide ADB key and tell ADB where it is using the ADB_VENDOR_KEYS environmental variable.
ADB_VENDOR_KEYS is described as a colon-separated list of keys (files or directories). You should be able to set it to a directory, but I was only able to get it to work with a file at the time. Since ADB is being run in a service, it is really important to set this as a system environmental variable and not a user environmental variable.
The set up steps are
adb start-server
or adb devices
. They key will be
located in C:\Users\<yourname>\.android
. If you are already running adb (probably the case) the adb server will already be started and a key will already be created.C:\adb_keys
and copy the key to this folderC:\adb_keys\adbkey
or where ever the key was placed in the previous step.adb kill-server
adb start-server
or adb devices
Restart the computer and queue up a new build that uses ADB and everything should work.