'How do I update Android SDK in Linux via command line

Is there a ubuntu commandline command to update my Android API, I need to download android-19

Note: I am using ubuntu commandline only, no GUI.

Thanks,



Solution 1:[1]

From the documentation:

Starting with Tools R12, the SDK Manager offers a slightly better way to update the SDK from command-line.

Previously the "android update sdk --no-ui" command already allowed one to update from the command-line, but it had the annoying tendency of installing every single platform or add-on. There are now 30 or more packages available on the SDK repository, including 12 platforms; that's a lot to download when most people only need the most recent platform. Starting with R12, you can use combine new things:

  • "android list sdk" will connect to the remote repository and list all the packages available with an index number.

  • "android update sdk --no-ui" accepts a "--filter" argument that can take a package index, or a category name.

Here's an example in action:

enter image description here

There's still room for improvement, notably in a future release we'll work on the first install case and making the update smarter at figuring out what to get.

Solution 2:[2]

Since the android command is deprecated you should use the sdkmanager command

Go to < Android Sdk dir >/cmdline-tools/latest/bin and run ./sdkmanager --update. This will update all packages to the latest version.

Note: < Android Sdk dir > is usually ~/Android/Sdk

To find the available packages

  • ./sdkmanager --list

Then once you know which package you want to install (for example API 30)

  • ./sdkmanager --install "platforms;android-30"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2