How to Install Android SDK Manager on Ubuntu 18.04

Install Android SDK Manager

The sdkmanager is a CLI tool that allows users to view, install, update, and uninstall available packages for the Android SDK.

This tutorial is going to teach you how to install Android SDK Manager on Ubuntu 18.04 using terminal. Earlier we have seen how to Install Android SDK Manager on Ubuntu 16.04.

If you're already using Android Studio, you don't need to use sdkmanager as you can manage your SDK packages from the IDE instead. The sdkmanager tool is provided in the Android SDK Tools package, so we are going to install the latter to be able to use sdkmanager.

Install Android SDK Tools Package

Before installing the preferred tool, we need to update all packages and install JAVA, as the Android SDK requires it to run. To do so you can run the following commands in the order mentioned below:

sudo apt update
sudo apt install default-jdk

Once JAVA is installed on the machine we can run the following command to check the java version and to be sure it has been installed correctly:

java -version

The output must look like this

openjdk version "10.0.1" 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)

After successful JAVA installation, we can proceed to the installation of Android SDK. We need to download the binaries from Android Developers Website. If you open the link above in the browser you can find available zip files under the "Command Line Tools only" part. To download binaries from terminal run the command below:


Once it's installed unzip with the following command


A new directory will be created named tools. To complete the installation we need to add the following paths to our PATH environment variable. To do so, you can run the command below:

export PATH=/home/ubuntu/tools:/home/ubuntu/tools/bin:$PATH

If you've downloaded or unzipped the SDK-tools package into other directory, please don't forget to use appropriate paths. To add the directories permanently, just add the line above to the ~/.bashrc or ~/.profile files.

Android SDK Manager usage 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

The output will look like the one below:

Installed packages:
 Path | Version | Description | Location
 ------- | ------- | ------- | -------
 platform-tools | 27.0.1 | Android SDK Platform-Tools | platform-tools/
 tools | 26.0.1 | Android SDK Tools 26.0.1 | tools/

Available Packages:
 Path | Version | Description
 ------- | ------- | -------
 add-ons;addon-g..._apis-google-15 | 3 | Google APIs
 add-ons;addon-g..._apis-google-16 | 4 | Google APIs
 add-ons;addon-g..._apis-google-17 | 4 | Google APIs
 add-ons;addon-g..._apis-google-18 | 4 | Google APIs
 add-ons;addon-g..._apis-google-19 | 20 | Google APIs
 add-ons;addon-g..._apis-google-21 | 1 | Google APIs
 add-ons;addon-g..._apis-google-22 | 1 | Google APIs
 add-ons;addon-g..._apis-google-23 | 1 | Google APIs
 add-ons;addon-g..._apis-google-24 | 1 | Google APIs
 add-ons;addon-g...e_gdk-google-19 | 11 | Glass Development Kit Preview
 system-images;a...s_playstore;x86 | 2 | Google Play Intel x86 Atom Sys...
 system-images;a...laystore;x86_64 | 2 | Google Play Intel x86 Atom_64 ...
 tools | 26.1.1 | Android SDK Tools

Available Updates:
 ID | Installed | Available
 ------- | ------- | -------
 tools | 26.0.1 | 26.1.1

You can have issues when running this command. E.g. the output of the command can be an error like the one below:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
 Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
 at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
 at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
 at java.base/java.lang.ClassLoader.loadClass(
 ... 5 more

To resolve this issue edit the sdkamanger script which is located in bin folder of the installation folder (in our case the full path to the file was /home/ubuntu/tools/bin/sdkamanager) and add the following line in the 31st line:

-XX:+IgnoreUnrecognizedVMOptions --add-modules

After the editing, that line must look like below:

DEFAULT_JVM_OPTS='"$APP_HOME" -XX:+IgnoreUnrecognizedVMOptions --add-modules'

Once you've edited the file and saved you can run the sdkmanager --list command again. Only installed packages will be shown and another error message will appear which will be like the one below:

Warning: java.lang.RuntimeException: Unexpected error: the trustAnchors parameter must be non-empty
Warning: Failed to download any source lists!
Warning: File /home/ubuntu/.android/repositories.cfg could not be loaded.

Actually there are two separate errors in the message above. One is related to secure connection due to which it cannot view available packages and check the packages for updates. The second one says that sdkmanager cannot load /home/ubuntu/.android/repositories.cfg file.

To fix the errors we create the repositories.cfg file (as it hasn't been created by default) and run the sdkmanager --list command with --no_https flag. Run the following commands in the order below:

touch /home/ubuntu/.android/repositories.cfg
sdkmanager --no_https --list

After running these commands you will be able to see the output shown above in this article.

Install, update and uninstall packages using sdkmanager

To install package, run the following command:

sdkmanager --no_https [package_name]

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 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]


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

Read also :

The installation of Android SDK Manager itself is very simple, but during the process you may face different issues which are related to JAVA. However, there are workarounds described for types of issues you can face. So using this tutorial you can be sure that you'll make it work.

13 Comments... add one

    • Actually the issue comes from JDK version. if you install default-jdk it installs openjdk11, which causes the problems described in the article. to avoid https problem you can use openjdk8. try to remove jdk11 and install jdk8. This will solve the issue

  1. Hi! I got the message when i wanna install platform-tools with this command " sdkmanager "platform-tools" "platforms:Android-28" "

    Here is the message
    Warning: Failed to read or create install properties file.

    could you help me, please!

  2. when I run this command "sdkmanager --list" I get this answer
    " Error occurred during initialization of boot layer
    java.lang.module.FindException: Module not found"

  3. These instructions do not work anymore (in my experience). I am running in a relatively newly created VM using Ubuntu 18.04 with Android Studio installed. I am getting the following error:

    developer@spaceinvader-dev:~$ ./Android/Sdk/tools/bin/sdkmanager --list
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
    at java.base/java.lang.ClassLoader.loadClass(

    developer@spaceinvader-dev:~$ which java
    developer@spaceinvader-dev:~$ java --version
    openjdk 11.0.3 2019-04-16
    OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)
    OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing)

  4. There *IS* no "tools" vs "full" option anymore. Google only provides the full, bloated sack of code now. No basic, simple, small package. Probably because it's too much mental effort for Google to provide two versions.


Leave a Comment