Flutter doctor can't find sdkmanager

Viewed 3523

So I'm trying to install flutter without Android Studio because my PC work really slow whenever i trying to open Android Studio. Everything working smoothly at beginning, but when flutter trying to get Android License using

flutter doctor --android-licenses

it always give me

C:\Windows\System32>flutter doctor --android-licenses
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to
resolve this.

and when i'm check using

flutter doctor --android-licenses -v

it give me

C:\Windows\System32>flutter doctor --android-licenses -v
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to
resolve this.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1      AndroidLicenseValidator.runLicenseManager (package:flutter_tools/src/android/android_workflow.dart:422:7)
#2      Doctor.diagnose (package:flutter_tools/src/doctor.dart:295:38)
#3      DoctorCommand.runCommand (package:flutter_tools/src/commands/doctor.dart:50:47)
#4      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1274:12)
<asynchronous suspension>
#5      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
<asynchronous suspension>
#6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#8      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
<asynchronous suspension>
#9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
<asynchronous suspension>
#11     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#13     main (package:flutter_tools/executable.dart:92:3)
<asynchronous suspension>

is there is anything wrong with my PATH or something hat i need to do first? I will include my path if that can help me. enter image description here

enter image description here

Thank you.

5 Answers

It looks like you might be missing the command-line tools.

If you want to install the command-line tools without installing Android studio then I would suggest taking a look at this website here. It lists all the android sdk tools you can download without needing to install android studio.

If you do want to install android studio I was able to solve this problem just recently by going to Tools>SDK Manager>SDK Tools and selecting "Android SDK Command-line Tools (latest)", then hit okay to install the tools.

After you do that try doing flutter doctor --android-licenses again

*N\B: I believe by default you had already installed thhe commandline tools. Go to the folder containing the sdkmanager.bat file and then open the cmd from there. The cmd should show the folder in which it is open. Run the following command, 'sdkmanager.bat --install "cmdline-tools;latest" After completely running the task close the cmd and open a new one and run 'flutter doctor'

This error could be solved from android studio go to SDK tools and click on android SDK command-line tools and install them.

I ran into two issues. I started with a default install of Android Studio and flutter from flatpack.

  1. When you download commandlinetools...zip from Google, and unzip it, you get directories like cmdline-tools/bin, cmdline-tools/lib etc. That doesn't work. You need to create a latest subdirectory and move everything in there. e.g. /home/user/Android/Sdk/cmdline-tools/latest/bin/
  2. Now you can run the updater. Something that works will look like ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --sdk_root=/home/user/Android/Sdk --install "cmdline-tools;latest". When I first installed, instead of /home/user/ I did ~/ and that caused problems subsequent to updating. The value you provide to --sdk_root gets cached somewhere.

Now you can run flutter doctor successfully to accept the licenses.

On Windows, you may also need to set the android-sdk location. It's usually in C:\$USER\AppData\Local\Android\Sdk.

You can set it by running flutter config --android-sdk <path to android sdk>.

This fixed the same issue for me.

Related