Android SDKManager Download SDK From Terminal

Once Android SDK has been installed we can use sdkmanager tool to view, install, update and uninstall packages for the Android SDK from terminal.

List installed, available packages and updates

To list all installed, available packages and ones that have update we can run:

sdkmanager –list

Install, update and uninstall packages using sdkmanager

To install package, run the following command:

sdkmanager --no_https [package_name]

eg: sdkmanager “platforms:android-28”

If you want to uninstall several packages you can add them to a file and use –package_file flag. For example

sdkmanager --no_https --package_file=/path/to/package_file

Note that package_name must be from available packages list and if you don’t use no_https flag it will throw the same error when we ran the sdkmanager --list command.

To update all packages, you can run:

sdkmanager --no_https --update

Note that if you update SDK tools you need to edit /home/ubuntu/tools/bin/sdkamanager file again and add -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee in the 31st line, as the mentioned above file will be fetched from the server and will become the default one.

To uninstall package, run the command below:

sdkmanager --uninstall [package_name]

or

sdkmanager --uninstall --package_file=/path/to/package_file

source: https://linoxide.com/linux-how-to/install-android-sdk-manager-ubuntu/