To Solve Android sdkmanager tool not found in Flutter The right solution would be if you have android studio installed then the command flutter doctor and it should now prompt you to run flutter doctor –android-licenses, once you run the license command, accept all licenses by hitting Y and it should solve the problem.
To use the SDK Manager to install a version of the command line tools, follow these steps: Download the latest "command line tools only" package from the Android Studio downloads page and unzip the package. Move the unzipped cmdline-tools directory into a new directory of your choice, such as android_sdk .
You can launch the SDK Manager in one of the following ways: From Eclipse (with ADT), select Window > Android SDK Manager. On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
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.
sdkmanager
lives inside cmdline-tools/tools/bin
, you'd better set in PATH
environment variablecmdline-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
.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:
ANDROID_SDK_ROOT
(just like before)cmdline-tools
, which is inside ANDROID_SDK_ROOT
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin
to environment variable PATH
, so that the system knows where to find sdkmanager
!!UPDATE!!
The behavior has changed again since the build 6858069
(Android SDK Command-line Tools 3.0):
cmdline-tools
.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 source.properties
. 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.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.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.
For those who struggled with installing Android Command Line Tools for Appium on Windows 10/x64 just do as following:
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.
Install Android-SDK.
sudo apt install android-sdk
After the instalation you will have a folder called android-sdk in /usr/lib
Create a folder called cdmline-tools inside the android-sdk folder
sudo mkdir /usr/lib/android-sdk/cmdline-tools
Download the Android command line tools zip from here (https://developer.android.com/studio?hl=en-419#downloads)
Unpack the file you just downloaded inside /usr/lib/android-sdk/cmdline-tools
sudo unzip /path/for/commandlinetools-linux-6200805_latest.zip -d /usr/lib/android-sdk/cmdline-tools
Go to you home dir and edit your .profile
nano .profile
Create an ANDROID_SDK_ROOT variable
export ANDROID_SDK_ROOT=/usr/lib/android-sdk
Put the sdkmanager folder in your path
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$PATH
Save and Exit
Reload you profile
. ~/.profile
Run
sdkmanager --version
You should see the version printed in your terminal.
Downloading the new cmdline-tools from Android Developer website requires the following directory structure to be respected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With