'SDKmanager : Warning: Could not create setting. java.lang.IllegalArgumentException

Im trying to install androidSDK on my Ubuntu but when i try to run the SDK manager on the tools/bin/sdkmanager folder i get this message:

My Ubuntu was installed recently and still have nothing on it except for Java 8 and Android Studio.

My SDK folder is the default ~/Android/Sdk.

java.lang.IllegalArgumentException
    at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Usage:
  sdkmanager [--uninstall] [<common args>] [--package_file=<file>] [<packages>...]
  sdkmanager --update [<common args>]
  sdkmanager --list [<common args>]
  sdkmanager --licenses [<common args>]
  sdkmanager --version

With --install (optional), installs or updates packages.
    By default, the listed packages are installed or (if already installed)
    updated to the latest version.
With --uninstall, uninstall the listed packages.

    <package> is a sdk-style path (e.g. "build-tools;23.0.0" or
             "platforms;android-23").
    <package-file> is a text file where each line is a sdk-style path
                   of a package to install or uninstall.
    Multiple --package_file arguments may be specified in combination
    with explicit paths.

With --update, all installed packages are updated to the latest version.

With --list, all installed and available packages are printed out.

With --licenses, show and offer the option to accept licenses for all
     available packages that have not already been accepted.

With --version, prints the current version of sdkmanager.

Common Arguments:
    --sdk_root=<sdkRootPath>: Use the specified SDK root instead of the SDK
                              containing this tool

    --channel=<channelId>: Include packages in channels up to <channelId>.
                           Common channels are:
                           0 (Stable), 1 (Beta), 2 (Dev), and 3 (Canary).

    --include_obsolete: With --list, show obsolete packages in the
                        package listing. With --update, update obsolete
                        packages as well as non-obsolete.

    --no_https: Force all connections to use http rather than https.

    --proxy=<http | socks>: Connect via a proxy of the given type.

    --proxy_host=<IP or DNS address>: IP or DNS address of the proxy to use.

    --proxy_port=<port #>: Proxy port to connect to.

    --verbose: Enable verbose output.

* If the env var REPO_OS_OVERRIDE is set to "windows",
  "macosx", or "linux", packages will be downloaded for that OS. ```


Solution 1:[1]

After messing around with the console, i think i found out what is happening. Apparently there's a bug in the way the SDK locates the SDK installation folder.

So all i needed to do way specify it by using --sdk_root=${ANDROID_HOME} after exporting the path with export ANDROID_HOME=~/Android/Sdk

So the full command was yes | ~/Android/Sdk/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} --version

Got the solution from another post: Android Command line tools sdkmanager always shows: Warning: Could not create settings

Solution 2:[2]

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 sources.properties" files inside this version folder.

  2. Set ANDROID_HOME to your android_sdk folder.

  3. Add to your System Path: android_sdk\cmdlineAndroidSDK\cmdline-tools\version\bin\

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

Solution 3:[3]

Using the docs as guide I was able to make it work moving the installation to the following path in Windows: %LocalAppData%\Android\android-sdk\cmdline-tools\2.1 for version 2.1. Similar to what shahab Uddin suggested but with - instead of _ in android-sdk.

Your version can be checked in the source.properties file.

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 G10v4nn1
Solution 2 shahab Uddin
Solution 3 7hi4g0