Today I wanted to diagnose a problem on my Android phone. It had been a while since I wrote any Android code, so adb wasn’t installed on my computer. I decided to just quickly install the Android command line tools, rather than the full SDK. This turned out not to be so quick after all. In the end, I had to download the tools, extract them into a particular folder hierarchy, move some files around, install Java, and set some environment variables. It’s like someone was trying to make this difficult! Here’s what worked for me on Windows 10. Maybe it will help someone else.

  1. Downloaded and Installed the Java Runtime Environment (currently version 8 update 241).
  2. Download the latest Android command line tools. That’s at the time I’m writing this.
  3. Extracted to C:\android\cmdline-tools\latest, following the guidance here. To clarify, the downloaded zip file contained a folder named tools, and I renamed that folder to latest and placed it in C:\android\cmdline-tools. Why would a specific folder structure be required? I don’t know, and I’m not taking the time now to investigate.
  4. Followed the advice here and copied the files in latest\lib\_ to latest\lib. This doesn’t feel right to me… why would the zip file include a folder structure that doesn’t work? I’m sure there’s more going on here, but for now I’m going with that works.
  5. Added an environment variable named ANDROID_HOME and set it to C:\android\cmdline-tools\latest.
  6. Added %ANDROID_HOME%\bin to my PATH.
  7. Opened a cmd prompt and ran sdkmanager "platform-tools". This installed adb and more to C:\android\platform-tools.
  8. With my Android device connected to my PC with USB debugging enabled, checked that adb is working by running adb devices.

That took more effort than I expected, but at least adb works now!