(报错)Flutter Unable to locate Android SDK.

Error message Flutter Unable to locate Android SDK

[] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.14393], locale zh-CN)
[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).
      If Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

Insert picture description here

solution:

(1) The error message is obviously that the local Android SDK was not found. Therefore, we need to configure environment variables on the computer.
Right-click My Computer>Properties>Advanced System Settings>Environment Variables>New ANDROID_HOME in User Variables, the variable value is After setting the Android SDK path
Insert picture description here
, restart the computer

(2) If option 1 does not work, then you need to execute the cmd command flutter doctor --android-licenses, and keep pressing y

Insert picture description here
If you enter flutter doctor --android-licenses and report an error, go to the flutter sdk folder and find flutter_console, click to open and enter flutter doctor --android-licenses

Insert picture description here

(3) If none of the above methods work,
I suggest you delete the configuration of the Android SDK you configured, then add it again, and finally remember to restart the computer (the editor is the solution of the third solution, and the pro test is effective)

Guess you like

Origin blog.csdn.net/qq_45353823/article/details/107759260