flutter doctor --android-licenses 报错:Android sdkmanager tool not found (C:\Users\xxx\AppData\Local\Android\sdk\tools\bin\sdkmanager).


问题背景:

flutter doctor --android-licenses

发现出现以下报错:

Android sdkmanager tool not found (C:\Users\xxx\AppData\Local\Android\sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.

解决方案:

open Android Studio's SDK Manager go to the Android SDK tab Under SDK Tools, uncheck Hide Obsolete Packages Install Android SDK Tools (Obsolete)

问题产生原因:

Warning: In Android Studio 3.6 or later, you need to manually add the old version of the Android SDK Tools for Flutter to work.

此外需要注意的是,如果之前修改了 SDK location 需要修改回来,flutter 不会自动识别(不知道为啥)

成功的标识是 C:\Users\xxx\AppData\Local\Android\sdk\tools\bin\sdkmanager 这个路径存在

参考文档: https://github.com/flutter/flutter/issues/20976 https://flutter.dev/docs/get-started/install/windows