Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Fix ADB Vendor Keys Not Set Error

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

The "adb vendor keys are not set" error appears when you try to connect to a device over ADB (Android Debug Bridge) and the device rejects the connection because it doesn't recognize your computer's signing key. This usually happens after a fresh ADB install, after clearing ADB data, or when switching between different ADB versions. The fix is to generate a new set of vendor keys and authorize your computer on the device. Below is a step-by-step guide to resolve it.

What You'll Need

  • A computer with ADB installed (platform-tools). If you don't have it, download the official platform-tools from the Android developer website.
  • The Android device you're trying to connect to, with USB debugging enabled (in Developer Options).
  • A USB cable that supports data transfer (not charge-only).
  • Access to a terminal or command prompt on your computer.

Step-by-Step

  1. Open a terminal or command prompt on your computer. On Windows, you can right-click the Start button and select "Command Prompt" or "PowerShell". On macOS or Linux, open the Terminal app.
  2. Navigate to the platform-tools folder if it's not in your system PATH. For example, if you extracted platform-tools to C:\platform-tools, type cd C:\platform-tools and press Enter. On macOS/Linux, use something like cd ~/platform-tools.
  3. Check if ADB is working by typing adb version and pressing Enter. You should see the ADB version number. If you get "command not found", you need to either add platform-tools to your PATH or run the command from the folder where adb.exe is located.
  4. Generate new vendor keys by running the command: adb keygen ~/.android/adbkey (on Windows, use adb keygen %USERPROFILE%\.android\adbkey). This creates a new private key and public key in your user's .android folder. If the folder doesn't exist, ADB will create it.
  5. Restart the ADB server by running: adb kill-server then adb start-server. This ensures the new keys are loaded.
  6. Connect your Android device via USB. If you haven't already, enable USB debugging on your device: go to Settings > About Phone and tap "Build Number" seven times to unlock Developer Options. Then go to Settings > Developer Options and enable "USB debugging".
  7. Run adb devices in your terminal. You should see a prompt on your device asking "Allow USB debugging?" with a fingerprint of the RSA key. Check "Always allow from this computer" and tap OK.
  8. Verify the connection by running adb devices again. You should see your device listed as "device" (not "unauthorized"). If it still says "unauthorized", repeat the steps, but also try revoking USB debugging authorizations on the device (in Developer Options, tap "Revoke USB debugging authorizations") and then reconnect.

Common Mistakes

  • Not generating keys in the correct location: ADB expects the keys to be in the .android folder in your home directory. If you run keygen elsewhere, ADB won't find them.
  • Forgetting to restart the ADB server: The server caches the old keys. Always run adb kill-server and adb start-server after generating new keys.
  • Using a charge-only USB cable: If the cable doesn't support data, the device won't show up at all. Try a different cable.
  • Not enabling USB debugging: Without it, the device won't accept ADB connections. Double-check that Developer Options is enabled and USB debugging is on.
  • Ignoring the device prompt: If you don't tap "Allow" on the device, it stays unauthorized. Always confirm the RSA key prompt.

Tips

  • If you're on Linux or macOS, you may need to set permissions on the adb binary: run chmod +x adb in the platform-tools folder.
  • On Windows, if you get a driver error, install the official USB driver from the device manufacturer (e.g., Google USB Driver for Pixel, Samsung USB Driver, etc.).
  • If you're using a wireless connection (ADB over Wi-Fi), the same key issue applies. Generate keys, then connect via adb pair and adb connect.
  • Keep your platform-tools up to date. Older versions may have bugs with key generation. Download the latest from the Android developer site.

Troubleshooting

If the error persists after following the steps, try these in order:

  1. Check the device's screen: Sometimes the authorization prompt appears but gets hidden. Unlock your device and look for a dialog.
  2. Revoke USB debugging authorizations: On your device, go to Developer Options > Revoke USB debugging authorizations. Then reconnect and accept the prompt.
  3. Reinstall ADB: Uninstall the current platform-tools completely (delete the folder) and download a fresh copy from the official site. Then repeat the key generation.
  4. Check the ADB server logs: Run adb -l logcat (or adb logcat) after connecting to see if there are specific errors. This can help identify if it's a key issue or something else.
  5. Try a different USB port: Some ports (especially front-panel ones) may have power or data issues. Use a rear port on a desktop.
  6. If all else fails, restart both your computer and your phone. Then repeat the steps from the beginning, making sure to generate new keys and restart the server.

Frequently Asked Questions

What are ADB vendor keys?

ADB vendor keys are a pair of RSA keys (private and public) that your computer uses to authenticate with Android devices. The device stores the public key after you authorize it, and the private key stays on your computer.

Why did the error suddenly appear?

It usually appears after a system update, a reinstall of ADB, or if the .android folder was deleted or corrupted. It can also happen if you switch between different ADB versions that use different key locations.

Can I use the same keys on multiple computers?

Yes, you can copy the adbkey and adbkey.pub files from one computer to another. Place them in the .android folder on the new computer. Then the new computer will be recognized as authorized on devices that already have the public key.

Is it safe to generate new keys?

Yes, it's safe. You'll just have to re-authorize your computer on any device you connect to. No data is lost on the device.

What if I don't have a .android folder?

The keygen command will create it automatically. If it doesn't, create the folder manually in your home directory (or %USERPROFILE% on Windows) and run the keygen again.

Does this work for both USB and wireless ADB?

Yes, the same keys are used for both USB and wireless connections. After generating new keys, you'll need to re-authorize for both methods.