Android Command line tools sdkmanager always shows: Warning: Could not create settings

The question:

I use the new command line tools for Android because the old sdk-tools repository of Android isn’t available anymore. So I changed my gitlab-ci to load the commandlintools. But when I try to run it I get the following error:

Warning: Could not create settings

I already tried executing those commandy by hand, but I get the same error. Also if I run sdkmanager --version, the same error occurs.
My gitlab-ci looks like:

image: openjdk:9-jdk

  ANDROID_SDK_TOOLS:   "6200805"

  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - wget --quiet${ANDROID_SDK_TOOLS}
  - unzip -d android-sdk-linux
  - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
  #- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
  - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
  - export ANDROID_HOME=$PWD/android-sdk-linux
  - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
  - chmod +x ./gradlew
  # temporarily disable checking for EPIPE error and use yes to accept all licenses
  - set +o pipefail
  - yes | android-sdk-linux/tools/bin/sdkmanager --licenses
  - set -o pipefail

  - build
  - test

  stage: build
    - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint

  stage: build
    - ./gradlew assembleDebug
    - app/build/outputs/

  stage: test
    - ./gradlew -Pci --console=plain :app:testDebug

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Instead of passing the argument --sdk_root for each single command execution, let’s deep dive into the real cause.

Starting from Android SDK Command-line Tools 1.0.0 (6200805), in contrast to Android SDK 26.1.1 (4333796), the tools directory hierarchy has been changed.
Previously it was placed right inside ANDROID_HOME (which is deprecated, we will use the term ANDROID_SDK_ROOT for the rest of the paragraph), now it’s still named as tools (the only thing you’ll get after unpacking the downloaded commandlinetools zip file), but differently, you have to place it inside a directory called cmdline-tools on your own. The name cmdline-tools comes from its package name, where you can get from listing packages command sdkmanager --list, whose outputs include cmdline-tools;1.0 | 1.0 | Android SDK Command-line Tools.

Wrapping tools directory inside cmdline-tools directory would make it work, and help you get rid of the annoying --sdk_root argument. But what about the other parts?

Well, that’s all you have to change. Let me explain more.

  • The king – sdkmanager lives inside cmdline-tools/tools/bin, you’d better set in PATH environment variable
  • cmdline-tools should not be set as ANDROID_SDK_ROOT. Because later, when updating Android SDK, or installing more packages, the other packages will be placed under ANDROID_SDK_ROOT, but not under cmdline-tools.
  • The final, complete ANDROID_SDK_ROOT directory structure should look like below, consist of quite a few sub-directories: build-tools, cmdline-tools, emulator, licenses, patcher, platform-tools, platforms, system-images. You can easily point out that build-tools and cmdline-tools are siblings, all sit inside the parent ANDROID_SDK_ROOT.

Let me recap in a simple way:

  • Set your preferred ANDROID_SDK_ROOT (just like before)
  • Download and unpack the commandlinetools zip file into a directory called cmdline-tools, which is inside ANDROID_SDK_ROOT
  • Append the directory $ANDROID_SDK_ROOT/cmdline-tools/tools/bin to environment variable PATH, so that the system knows where to find sdkmanager


The behavior has changed again since the build 6858069 (Android SDK Command-line Tools 3.0):

  • After unzipping the package, the top-most directory you’ll get is cmdline-tools.
  • Rename the unpacked directory from cmdline-tools to tools, and place it under $ANDROID_SDK_ROOT/cmdline-tools, so now it should look like: $ANDROID_SDK_ROOT/cmdline-tools/tools. And inside it, you should have: NOTICE.txt bin lib Actually according to the official Command-Line Tools doc, the tree structure should be android_sdk/cmdline-tools/version/bin/, but I’ve checked, using version or tools makes no difference here.
  • For your environment variable PATH, I would recommend you to set like this: PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin, because after update later, you’ll get the latest sdkmanager placed under $ANDROID_SDK_ROOT/cmdline-tools/latest/bin, put it in front will make it higher priority.

Method 2

This appears to be a bug with the way sdkmanager locates the SDK installation folder.

A work-around is to set the flag --sdk_root. You can move ANDROID_HOME declaration higher, then use it with the subsequent commands.

 - export ANDROID_HOME=$PWD/android-sdk-linux
 - yes | android-sdk-linux/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --licenses
 - android-sdk-linux/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools" "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null

Also, moved blanket license acceptance command to the first command to clean up the echo y parts.

Oddly enough if you run sdkmanager --sdk_root=${ANDROID_HOME} "tools" it will upgrade tools from 3.6.0 to 26.1.1 and sdkmanager no longer has this issue. This update takes time and bandwidth and isn’t exactly necessary with the work-around.

Method 3

For those who struggled with installing Android Command Line Tools for Appium on Windows 10/x64 just do as following:

  1. Download latest Command line tools from android i.e.
  2. Unzip the downloaded file
  3. Create directory for storing commandline tools somewhere on your disk, with following path included: android/cmdline-tools/latest Basically when You unzip this Cmd line tools, just rename tools directory to latest and make sure You put this latest folder in android/cmdline-tools directory somewhere on your disk
  4. Create ANDROID_HOME environment variable for directory that stores the cmdline tools directory location like:
  5. Create new entry in Path environment variable as %ANDROID_HOME%bin

Method 4

The sdkmanager tries to figure out the android-sdk path based in where it’s unpacked, without use the environment variables, like ANDROID_SDK_ROOT. But it’s get worse, because it have a hard coded parent folder named cmdline-tools and if you unzip commandlinetools inside a folder with another name, it doesn’t work, forcing us to use the parameter sdk_root to feed the inside variable correctly.

So, with that in mind we can use the following approach to solve this.

I will assume that we are using Ubuntu OS, so if you aren’t, you should adapt some of that instructions.

  1. Install Android-SDK.

     sudo apt install android-sdk

    After the instalation you will have a folder called android-sdk in /usr/lib

  2. Create a folder called cdmline-tools inside the android-sdk folder

     sudo mkdir /usr/lib/android-sdk/cmdline-tools
  3. Download the Android command line tools zip from here (

  4. Unpack the file you just downloaded inside /usr/lib/android-sdk/cmdline-tools

     sudo unzip /path/for/ -d /usr/lib/android-sdk/cmdline-tools
  5. Go to you home dir and edit your .profile

     nano .profile
  6. Create an ANDROID_SDK_ROOT variable

     export ANDROID_SDK_ROOT=/usr/lib/android-sdk
  7. Put the sdkmanager folder in your path

     export PATH=$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$PATH
  8. Save and Exit

  9. Reload you profile

     . ~/.profile
  10. Run

    sdkmanager --version

You should see the version printed in your terminal.

Method 5

Downloading the new cmdline-tools from Android Developer website requires the following directory structure to be respected.

Method 6

Simple Solution:

  1. Open Android Studio Tools Menu,
  2. SDK Manager In the window that comes
    up there are inner panels,
  3. Choose SDK Tools panel Tick Android SDK Command-line Tools
  4. Choose Apply button near the bottom of the window

Method 7

Mixing responses from Jing Li and caller9, this is my script:

  ANDROID_SDK_TOOLS: "6200805"

  - apt-get update --yes
  - apt-get install --yes wget tar unzip lib32stdc++6 lib32z1
  - export ANDROID_HOME=${PWD}android-home
  - install -d $ANDROID_HOME
  - wget --output-document=$ANDROID_HOME/${ANDROID_SDK_TOOLS}
  - pushd $ANDROID_HOME
  - unzip -d cmdline-tools
  - popd
  - export PATH=$PATH:${ANDROID_HOME}/cmdline-tools/tools/bin/
  - sdkmanager --version
  - set +o pipefail
  - yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses
  - set -o pipefail
  - sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-${ANDROID_COMPILE_SDK}"
  - sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools"
  - sdkmanager --sdk_root=${ANDROID_HOME} "build-tools;${ANDROID_BUILD_TOOLS}"
  - export PATH=$PATH:${ANDROID_HOME}/platform-tools/
  - chmod +x ./gradlew

Method 8

I found the solution to use the latest command-line tools following those steps:

1 – Extracting the Command-line tools into a folder with this structure:
e.g.: $HOME/Development/android/cmdline-tools/latest
(this folder must contain lib, bin, notice.txt and

2 – Defining ANDROID_HOME as an environment variable:


3 – Loading it on PATH:


Method 9

Got the same issue, came here by Google.
According to the AndroidStudio Archive, today was the release of 4.1.
I suppose that’s no coincidence.

This completely unrelated guide has a hardlink for an older version of the sdk-tools for linux.
You can change the url to windows or mac for other OSs. I’ll use that as a hotfix for now.

(that was supposed to be a comment not a solution)

Method 10

Summarizing several useful posts here, and for people wanting a quick snippet, for example to plug in a Dockerfile, the following script is working for me:

RUN mkdir -p /opt/android/cmdline-tools/latest 
    && cd /opt/android/cmdline-tools/latest 
    && wget 
    && bsdtar --strip-components=1 -xvf 
    && yes | bin/sdkmanager --licenses 
    && bin/sdkmanager "build-tools;29.0.2" "platforms;android-29" 
    && rm

It just requires bsdtar to be installed (it’s usually packaged in popular distributions). Android platform/build tools version 29 are installed, and Android sdk root will be then located in /opt/android. While this setup works for me without warnings as it is, I have an issue when reinstalling packages already installed, or possibly installing different version of the packages: it clashes with packages already present and create bogus directories in the sdk root, with -2, -3 suffixes. These directories are then ignored, and warnings like Observed package id 'emulator' in inconsistent location are printed, so this behavior is definitely not desirable. If you have a fix for that please write it in the comments or, if you are confident enough, just edit the script with the exact fix.

Method 11

Just solved this issue with IDE, looks pretty simple to me. (Actually this duplicate previous answer but with the picture). Just install sdk tools and everything should work.

Android Command line tools sdkmanager always shows: Warning: Could not create settings

Method 12

I got the same error. After doing all solutions, i could not fix it. I solved this problem by reading:

Simplify an answer:

  1. Opening sdkmanager.bat by notepad++

  2. Changing this line from




(Note: Adding --sdk_root=%ANDROID_HOME% at the end

Method 13

I would like to share my experience.

At first I try to explain why directory structure has to look
the way shown in this answer – . asked for explanation several times so hope I will clarify
the situtation with the next experiment:

1. unpack cmdline-tools to any path, for example c:Androidtools;
2. create a folder for SDK, let it be c:AndroidSDK;
3. install cmdline-tools (yes, we install cmdline-tools again =)):
    c:Androidtoolsbinsdkmanager --sdk_root=c:AndroidSDK "cmdline-tools;latest"
4. at this moment we can examine c:AndroidSDK and locate
    the path c:AndroidSDKcmdline-toolslatest. If we compare
    this folder with the previous version c:Androidtools we find out
    that they are identical. The new installed c:AndroidSDKcmdline-toolslatestsdkmanager works
    without --sdk_root argument so we could initially unpack cmdline-tools
    to cmdline-toolslatest.

One may encounter another issue – Stuck at “.android/repositories.cfg could not be loaded.”

Other issues & facts:

1. QtCreator works with another sdkmanager that placed in SDK_ROOT/tools/bin
2. SDK_ROOT/tools/bin/sdkmanager works only with JDK 8
3. Java uses its own storage for certificates and it's not convinient usually.
    Thus one may want to use Windows certificate store. Unfortunately Grandle has the
    issue - - so use the following:

To sum up the following recipe for development with Qt can be composed:

1. download
2. extract cmdline-tools so there will be hierarchy
        - cmdline-tools
            - latest
                - bin
                    - sdkmanager.bat
                    - ...
                - lib
                - ...
3. install JDK 8. set JAVA_HOME=c:pathtojava so that %JAVA_HOME%/bin/java.exe exists.
4. set
5. NDK may be downloaded manually or installed with sdkmanager
6. install required components:
    SDKROOTcmdline-toolslatestbinsdkmanager "tools" "build-tools;BUILD_TOOLS_VERSION" "platform-tools" "platforms;ANDROID_VERSION"
7. run qtcreator from console so JAVA_OPTS is taken into account (or set it globaly for windows user or even station)
8. tools -> options -> devices set paths to JDK 8, SDKROOT and NDK

Method 14

This happened to me when downloading the standalone command line tools (commandlinetools-mac-6200805_latest) on a new Mac.

Based on all the answers here, I was able to make it work like this

# Define ANDROID_HOME, if not defined already
export ANDROID_HOME="~/Library/Android/sdk"

# Create the folder if missing
mkdir -p $ANDROID_HOME

# Let the tool know that it should use that SDK location. 
sdkmanager --list --sdk_root=$ANDROID_HOME

The docs for the --sdk_root option say “Use the specified SDK root instead of the SDK containing this tool“. This made me think that, despite being shipped standalone, the tool expects to be part of a bundle where the SDK is installed aswell.

Method 15

Android SDK Tools now rest in following location: “android_sdk/cmdline-tools/version/bin/“;

Therefore to solve this problem in Windows (same can be replicated in other OS), do the following:

  1. Inside your android_sdk folder, create the folder: cmdline-tools and inside it create another folder: version extract / put all your files “/bin /lib NOTICE and” files inside this version folder.

  2. Set ANDROID_HOME to your android_sdk folder.

  3. Add to your System Path: android_sdkcmdlineAndroidSDKcmdline-toolsversionbin

Similarly, place your Android SDK Platform Tools inside your android_sdk/platform-tools/ and add corresponding PATH to ENVIRONMENTAL VARIABLES under System Variables

Method 16

Based on updated suggestions from @Jing Li. Here’s my version of gitlab-ci.yml

image: openjdk:8-jdk

  GRADLE_OPTS: "-Dorg.gradle.daemon=false"

  - export GRADLE_USER_HOME=$(pwd)/.gradle
  - chmod +x ./gradlew
  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - mkdir -p android-sdk-linux/cmdline-tools
  - export ANDROID_SDK_ROOT=$PWD/android-sdk-linux
  - cd android-sdk-linux/cmdline-tools
  - unzip
  - rm
  - mv cmdline-tools version
  - echo y | version/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
  - echo y | version/bin/sdkmanager "platform-tools" >/dev/null
  - echo y | version/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
  - export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
  # temporarily disable checking for EPIPE error and use yes to accept all licenses
  - set +o pipefail
  - yes | version/bin/sdkmanager --licenses
  - set -o pipefail
  - cd ../../
  - chmod +x ./gradlew

  key: ${CI_PROJECT_ID}
    - .gradle/

Method 17

This page from Unity 2018 documentation also has a good explanation of resolving this issue, including such points like:

  1. Installing the Android SDK without Android Studio.
  2. Workaround for “Warning: Could not create settings” and “java.lang.IllegalArgumentException”
  3. The trick for Android Studio version 3.6 or newer.
  4. Warning about Java 9 or later, a JDK must be version 8.

Method 18

The first requirement of installing SDK (Any method) is to install Java & setting JAVA_HOME path.

Then, SDK command-line tools need installation path without which it throws NullPointerException.
To overcome this just pass the path where you want to install SDK with argument “–sdk_root”
Eg. sdkmanager.bat “platform-tools” “platforms;android-” –sdk_root=

Method 19

If you are using Linux and at the same time, you don’t want to mess your hands with complex workarounds, I recommend you to download and use the Snap version of sdkmanager.

Remember to use androidsdk instead of sdkmanager in the terminal.

Method 20

Working Solution for Ubuntu using Android Studio
Here’s the working procedure for Ubuntu and Debian like linux :

  1. install Android studio as desribed in their website
  2. run : flutter config --android-studio-dir <location of android studio> then flutter config --android-sdk /home/user/Android/Sdk (this is the default location of the SDK)
  3. add the bin to your PATH PATH=$PATH:/home/user/Android/Sdk/tools/bin/
  4. Afterwards, run : flutter doctor --android-licenses and accept all licences
    To check if everything is ok run the doctor in verbos mode as following : flutter doctor -v

Method 21

Here is very basic and simple solution
just change the folder structure
change main folder name to latest
then create a folder named cmdline-tools
create new folder inside cmdline called tools and put bin and other data inside tools folder
so it will look like this

I have searched alot but it worked for me

Method 22

Android Studio is necessary when installing the command line tools even if it’s not the editor you use to develop apps with. Unchecking the obsolete packages tab and downloading the tools should do it; that should clear the license issue and you can go back to your favorite IDE (such as VS Code).

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment