PS C:\Myfolders\proj\flutter-proj\flutterapplicationtemp> flutter doctor…
- User
PS C:\My_folders\proj\flutter-proj\flutter_application_temp> flutter doctor --android-licenses Flutter assets will be downloaded from https://mirrors.cloud.tencent.com/flutter. Make sure you trust this source! Error: Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli Caused by: java.lang.ClassNotFoundException: com.android.sdklib.tool.sdkmanager.SdkManagerCli Android sdkmanager tool was found, but failed to run (C:\Users\Reza\AppData\Local\Android\sdk\cmdline-tools\latest\bin\sdkmanager.bat): "exited code 1".
Try re-installing or updating your Android SDK, visit https://flutter.dev/to/windows-android-setup for detailed instructions. PS C:\My_folders\proj\flutter-proj\flutter_application_temp> flutter config --jdk-dir="C:\Program Files\Android\Android Studio\jbr"Setting "jdk-dir" value to "C:\Program Files\Android\Android Studio\jbr".
You may need to restart any open editors for them to read new settings. PS C:\My_folders\proj\flutter-proj\flutter_application_temp> flutter doctor -v
Flutter assets will be downloaded from https://mirrors.cloud.tencent.com/flutter. Make sure you trust this source! [√] Flutter (Channel stable, 3.29.3, on Microsoft Windows [Version 10.0.26100.3775], locale en-US) [593ms] • Flutter version 3.29.3 on channel stable at C:\My_folders\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ea121f8859 (4 weeks ago), 2025-04-11 19:10:07 +0000 • Engine revision cf56914b32 • Dart version 3.7.2 • DevTools version 2.42.3 • Pub download mirror https://mirrors.cloud.tencent.com/dart-pub • Flutter download mirror https://mirrors.cloud.tencent.com/flutter[√] Windows Version (11 Pro 64-bit, 24H2, 2009) [2.5s]
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [1,027ms] • Android SDK at C:\Users\Reza\AppData\Local\Android\sdk • Platform android-35, build-tools 35.0.1 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java This JDK is specified in your Flutter configuration. To change the current JDK, run:
flutter config --jdk-dir="path/to/jdk". • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42) X Android license status unknown. Runflutter doctor --android-licensesto accept the SDK licenses. See https://flutter.dev/to/windows-android-setup for more details.[√] Chrome - develop for the web [139ms] • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.6) [137ms] • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.13.35931.197 • Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2024.3) [37ms] • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 21.0.6+-13355223-b631.42)
[√] VS Code (version 1.99.3) [35ms] • VS Code at C:\Users\Reza\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.110.0
[√] Connected device (3 available) [374ms] • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26100.3775] • Chrome (web) • chrome • web-javascript • Google Chrome 136.0.7103.93 • Edge (web) • edge • web-javascript • Microsoft Edge 136.0.3240.50
[√] Network resources [3.4s] • All expected network resources are available.
! Doctor found issues in 1 category. PS C:\My_folders\proj\flutter-proj\flutter_application_temp>
- Assistant
You are encountering this error when running
flutter doctor --android-licenses:Error: Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli Caused by: java.lang.ClassNotFoundException: com.android.sdklib.tool.sdkmanager.SdkManagerCli Android sdkmanager tool was found, but failed to run (C:\Users\Reza\AppData\Local\Android\sdk\cmdline-tools\latest\bin\sdkmanager.bat): "exited code 1".This is a common issue with the Android SDK's
cmdline-toolsinstallation, especially on Windows. The error means thecmdline-toolsare either corrupted, incomplete, or not structured correctly.
How to Fix
1. Remove Broken
cmdline-tools- Go to:
C:\Users\Reza\AppData\Local\Android\sdk\cmdline-tools - Delete the
latestfolder (or move it somewhere else as backup).
2. Download the Correct Command Line Tools
- Go to the official Android Command Line Tools download page.
- Download the Windows version (
commandlinetools-win-xxxx_latest.zip).
3. Extract and Place Correctly
- Extract the zip file.
- You will get a folder named
cmdline-tools(inside it, a folder namedbin, etc.). - Rename the extracted folder (the one containing
bin,lib, etc.) tolatest. - Place this
latestfolder inside:
C:\Users\Reza\AppData\Local\Android\sdk\cmdline-tools\
Final structure should be:
C:\Users\Reza\AppData\Local\Android\sdk\cmdline-tools\latest\bin C:\Users\Reza\AppData\Local\Android\sdk\cmdline-tools\latest\lib ...
4. Try Again
Open a new terminal and run:
flutter doctor --android-licenses
Extra Tips
- Make sure your JAVA_HOME is set to the JDK you want to use (though Flutter config usually handles this).
- If you have multiple
cmdline-toolsfolders (likelatest,tools,tools-preview), onlylatestis needed for new SDKs.
Why This Happens
- Sometimes, the SDK Manager or Android Studio creates a
latestfolder with the wrong structure, or the tools are not updated. - The
sdkmanager.batscript expects a certain folder structure and the presence of specific.jarfiles.
References
If you follow these steps, your
flutter doctor --android-licensesshould work!
If you still have issues, please paste the new error message here. - Go to:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.