Android study notes (21)-flutter doctor shows the solution of X Unable to locate Android SDK

Android study notes (21) - the solution to display X Unable to locate Android SDK when flutter doctor

​ After installing flutter, I plan to start a demo test, and the result is this sentence:

Unable to locate a development device; please run ‘flutter doctor’ for information about installing additional components.

​ So run flutter doctor: the following appears:

[✓] Flutter (on Linux, locale en_US.UTF-8, channel master)

[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
On first launch it will assist you in installing the Android SDK components.
(or visit for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.

[✓] Android Studio (version 3.0.0)
• Android Studio at /home/f/App/android-studio
• Gradle version 3.2
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] Connected devices(1 available)

The one in the middle ✗ Unable to locate Android SDK has been confusing for a long time, because all the Android SDKs have been updated, and you can't uninstall and re-install one just because you want to install flutter. So I checked it on the Internet, but there are still relatively few solutions on the Internet. Finally, I found an idea at . In fact, it is to add environment variablesANDROID_HOME, fill in the location of your SDK, and restart the computer.

details as follows:

1. Right-click this computer, open Properties, and click Advanced System Settings on the left

write picture description here

2. Click Environment Variables and add in User Variables

write picture description here
D:\AS\SDK (your SDK installation path)

3. Restart the computer

4. Enter flutter doctor to check, there is basically no problem with the following content

C:\Users\lenovo>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version 10.0.14393], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.0)
[√] Connected devices (1 available)

! No issues found!

Related: Android study notes (21)-flutter doctor shows the solution of X Unable to locate Android SDK