If you want to use the android command line tool sdkmanager to do this instead of the UI, this is the way to do it.
Prepare
Make sure that sdkmanager doesn't complain about repositories.cfg missing:
mkdir -p ~/.android && touch ~/.android/repositories.cfg
Also make sure that you are using Java 8 by calling java -version, otherwise sdkmanager won't work (as of time of writing). Using Java 8 can be solved in many different ways, e.g:
- Linux: sudo update-alternatives --config java
- macOS using SDKMAN!: sdk use java <VERSION>
- Other way
Use
For help with all the commands run sdkmanager --help
For listing available components:
sdkmanager --list
For installing a component:
sdkmanager --install "build-tools;28.0.3"
For uninstalling a component:
sdkmanager --uninstall "build-tools;26.0.2"