cmdline-tools : could not determine SDK root
Solution 1
Since new updates, there are some changes that are not mentioned in the documentation. After unzipping the command line tools package, the top-most directory you'll get is cmdline-tools. Rename the unpacked directory from cmdline-tools to tools, and place it under $C:/Android/cmdline-tools
now it will look like $C:/Android/cmdline-tools/tools
and it will work perfectly.
Solution 2
Downloading the Android SDK 29+ (command line tools for Android) from https://developer.android.com/studio#downloads.
For "commandlinetools-linux-7302050_latest.zip" the process was different from earlier approaches. Earlier after unpacking, the top folder was called tools
, but now the top folder is called cmdline-tools
.
The problem seems to be that the sdkmanager expects to reside in an environment called. /YOURPATH/cmdline-tools/SOMETHING/bin
but unpacks to /YOURPATH/cmdline-tools/bin
for Linux anyway.
if you get
Error: Could not determine SDK root.
Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: <sdk>/cmdline-tools/latest/
Unpack and make sure you have this path to the sdkmanager.
/YOURPATH/cmdline-tools/latest/bin/sdkmanager
How To
To get this to work, first create the path to your intended Android SDK /opt/android-sdk/cmdline-tools/
then unpack the SDK zip file to that location, and you will have
/opt/android-sdk/cmdline-tools/cmdline-tools/bin/sdkmanager
Now rename the second "cmdline-tools" to "latest"
/opt/android-sdk/cmdline-tools/latest/bin/sdkmanager
And now it should work.
Solution 3
You can create a folder latest
inside your cmdline-tools
and move all it's contents inside this folder. So, your full path will be C:\Android\cmdline-tools\latest\bin
. Using this config there is no need to define a ANDROID_SDK_ROOT
environment variable or a --sdk_root=
option. It'll assume that your SDK folder is C:\Android
, and it'll put all your files (system-images, licenses, ...) inside it.
Solution 4
If you don't want to move it to another location, you can use --sdk_root
to specify the folder where do you want to install and download Android SDK.
For example, if you want to use: X:\Dev\AndroidSDK
and you downloaded and unziped your the command line tools package in that folder, you'll have this path: X:\Dev\AndroidSDK\cmdline-tools\bin
for sdkmanager.bat
.
So, your command will be:
X:\Dev\AndroidSDK\cmdline-tools\bin>.\sdkmanager.bat --sdk_root=X:\Dev\AndroidSDK
PS: Don't use spaces on the path to AndroidSDK or it will not work
Solution 5
• Go to extracted folder android-sdk\cmdline-tools
• Create a folder named latest in it.
• Cut bin , lib ...etc & paste in latest folder.
• Go to cmd of android-sdk\cmdline-tools\latest folder and run:
sdkmanager “platform-tools” “platforms;android-28”
It solves the problem
alakmar Shafin
Updated on December 24, 2021Comments
-
alakmar Shafin over 2 years
C:\Android\sdk\bin>sdkmanager Error: Could not determine SDK root. Error: Either specify it explicitly with --sdk_root= or move this package into its expected location: \cmdline-tools\latest\
it shows like this, even after specifying the root in env variables. ANDROID_SDK_ROOT C:\Android\sdk
I am using windows 10 64 bit machine, I want to run flutter without android studio so followed instruction on this page https://medium.com/@quicky316/install-flutter-sdk-on-windows-without-android-studio-102fdf567ce4