Installing Android SDK Without Android Studio
The process is similar on macOS, Windows, and Linux. Here are the key steps:
- Install Java 17.
Make sure to select version 17. You’ll have issues if you use a newer version.
If installing on Windows, unless you have a strong reason not to, take the Installer up on its offer to stick this Java in your PATH.
If you have multiple versions of Java installed, you may have to select to use this version before running various Android tools, or using Gradle scripts for Android. Here is how to do that on macOS. Similar processes apply on Linux and Windows.
- Download the Android SDK.
The links to do this are most of the way down the Android Studio download page.
Don’t get tricked by the Dark Pattern on the page into accidentally downloading Android Studio. Your download should be around 100MB, not 1GB (that’s about 4 orders of magnitude difference if we count in binary).
Unzip it.
Rename the unzipped directory from
cmdline-tools
tolatest
.Now make some directories to contain it.
You want to end up with
latest
being nested inside the parent directoriesandroid/sdk/cmdline-tools
.If you’re on macOS or Linux, you could accomplish this by doing
mkdir -p android/sdk/cmdline-tools && mv latest android/sdk/cmdline-tools
.There’s probably a quick way to do this on Windows, but I don’t know Windows well enough to know a way that doesn’t just involve a lot of right-clicking and making new folders. So do that. If you know a better way, please tell me.
Stick that whole tree someplace you won’t forget. Don’t use your desktop or any place like that. On my Mac, I put it in
~/Library
. On Linux, I tend to keep a~/lib
and that’s a fine place. On Windows,c:\android
is fine.Add the full path to
...latest/bin
to your PATH.
On Windows, you can do that by clicking the Start button (or whatever MS calls it now), typing
Envir
and choosing the option to edit your local environment variables. Then, double click onPath
click theNew
button, and browse deep down into the directory structure you created until you’re atbin
.On Linux and macOS, stick it in your
.bashrc
,.zshrc
, or whatever rcfile matches your preferred shell. On my Mac, I did it by sticking this into my~/.zshrc
:
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_TOOLS_PATHS=$ANDROID_HOME/cmdline-tools/latest/bin:
export PATH=$ANDROID_TOOLS_PATHS:$PATH:
Just to make sure things are configured right, log out and log back in.
Now, in your terminal, you should be able to execute the following commands. This will get you the almost-newest versions of the various Android tools and system images that you need.
sdkmanager "platforms;android-33"
sdkmanager "platform-tools"
sdkmanager "build-tools;33.0.2"
sdkmanager emulator
sdkmanager "system-images;android-33;google_apis;x86_64"
sdkmanager --licenses
Before you paste the lines above in: If appropriate, change the x86_64 above to match your computer’s architecture. Most likely, this is only necessary if you’re on an Apple Silicon (M1/M2/…) Mac. In that case, use
arm64-v8a
.Say yes when prompted to agree to the various license terms.
- Windows Only: Enable a hypervisor. Microsoft has decent instructions here.
You should be all set.
Many thanks to Ben Shapiro,Kris Venden and Lauren Bricker for figuring this out.
Subscribe to my newsletter
Read articles from Abizeyimana Victor directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Abizeyimana Victor
Abizeyimana Victor
I will raise your revenues or decrease your costs using solutions based on logic and in most cases, it will involve a computer. Design - Build - Improve. I design solutions to your business problem, build it with you and your team and finally scale the solution to fix other related problems. I use Javascript and Python as the main languages for development but I am eager and faster to learn anything that would be put a solution on the table.