How to Install the Android SDK on Your Laptop
The Android SDK is the set of tools your laptop needs to talk to Android devices. The part you will use most is platform-tools, which includes ADB, the Android Debug Bridge. ADB lets your laptop send commands to your phone over a USB cable, and it is the backbone of almost every advanced Android tutorial, including our guide to a distraction free device.
TL;DR: Install platform-tools with android sdk install platform-tools, set your environment variables, and confirm with adb version.
What You Will Need
The Android CLI, already installed and working. If you do not have it yet, install it first using our Android CLI guide, then come back here.
Step 1: Install Platform-Tools
Open your terminal and run:
android sdk install platform-tools
This downloads ADB and its companions into your SDK directory. It takes under a minute on a decent connection.
Step 2: Install Anything Else You Need
Platform-tools is all you need for ADB work. If you plan to build apps later, you can add more. First, see what is available:
android sdk list
Then install any package by name, for example:
android sdk install build-tools
Step 3: Set Your Environment Variables
This is the step most guides skip, and the one that causes 90 percent of adb: command not found headaches. You are telling your laptop where the SDK lives and putting the platform-tools folder on your path.
Mac
echo 'export ANDROID_HOME="$HOME/Library/Android/sdk"' >> ~/.zshrc
echo 'export PATH="$ANDROID_HOME/platform-tools:$PATH"' >> ~/.zshrc
source ~/.zshrc
Linux
echo 'export ANDROID_HOME="$HOME/Android/Sdk"' >> ~/.bashrc
echo 'export PATH="$ANDROID_HOME/platform-tools:$PATH"' >> ~/.bashrc
source ~/.bashrc
If you use zsh on Linux, replace ~/.bashrc with ~/.zshrc in all three commands.
Windows (PowerShell, recommended)
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LOCALAPPDATA\Android\Sdk", "User")
[Environment]::SetEnvironmentVariable("Path", "$env:ANDROID_HOME\platform-tools;" + [Environment]::GetEnvironmentVariable("Path", "User"), "User")
Windows does not have a source command, so close the terminal and open a new one before testing.
Step 4: Verify Everything Works
Confirm ADB is installed and on your path:
adb version
If that prints a version, you are done. With a phone connected and USB debugging enabled, you can go one step further:
adb devices
Your device should appear in the list with the status device.
Troubleshooting
adb not recognized: your environment variables are not picked up yet. Restart the terminal completely. On Windows, make sure you used the User variable and not the System one unless you are an administrator.
Device shows as unauthorized: look at your phone. A debugging prompt is waiting for you to tap Allow.
Device does not show up at all: try a different cable. Many cheap cables are charge-only and carry no data.
Related: with ADB working, you can now use it to uninstall distracting apps or remove the Play Store and lock your setup down.
Comments
Post a Comment