I use the system is win10, development tools for vscode

First, Android SDK installation

When the flutter doctor command is run, Android Tool-chain is not installed and you need to install the Android SDK. However, the address provided is to download Android Studio and find the installation file online.

Run sdkManager as administrator after downloading and installing, and install the corresponding files. See this article for details.

2. Run official Demo

The first problem is that Gradle can’t get it. Because the default configuration is Google source, we can’t use Ali source to replace it because ali source updates slowly. The default configuration version is not updated.

180.96.71.188 dl.google.com 
180.96.71.188 dl-ssl.google.com
Copy the code

The problem is not shown when the flutter Run is used in F5 or debug mode. Here we run flutter Run in the console and find that some files of the Android SDK are not installed. We try to use sdkManager, but there is an error:

Downloading SDK Platform Android 8.1.0, API 27, Revision 1 Download finished with wrong size. Expected 65606517 bytes, Downloading SDK Platform Android 8.1.0, API 27, Downloading finished with wrong size. got 65738431 bytes.Copy the code

The solution is to use the command to install, add the Android SDK tool to the environment variable, then run sdkManager “platforms; Android-27 “, successfully installed. Run flutter Run again and it will run successfully.

conclusion

Although it is about building the environment to run Flutter, I feel that most of the problems encountered are Android. Since I have no experience with Android, the building process is quite difficult. I feel that there is no problem for Android developers, but it will be difficult for other developers.