Installing adb
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.
- Downloaded and Installed the Java Runtime Environment (currently version 8 update 241).
- Download the latest Android command line tools. That’s
commandlinetools-win-6200805_latest.zip
at the time I’m writing this. - Extracted to
C:\android\cmdline-tools\latest
, following the guidance here. To clarify, the downloaded zip file contained a folder namedtools
, and I renamed that folder tolatest
and placed it inC:\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. - Followed the advice here and copied the files in
latest\lib\_
tolatest\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. - Added an environment variable named
ANDROID_HOME
and set it toC:\android\cmdline-tools\latest
. - Added
%ANDROID_HOME%\bin
to myPATH
. - Opened a cmd prompt and ran
sdkmanager "platform-tools"
. This installed adb and more toC:\android\platform-tools
. - 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!