Article directory
1. Get Flutter SDK
-
Click the installation package below to get the latest version of Flutter SDK for the stable release channel: Flutter SDK
-
Unzip the compressed package, and then place the
flutter
entire directory in the path where you want to place the Flutter SDK** (be careful not to have a Chinese directory)** -
Configure the environment variables of the Windows system. In the User Variables column, add
flutter\bin
the full path to the directory in Path. For example:
-
After configuring the environment variables, you can open the cmd window of your computer and use the command
flutter doctor
The above command will check your existing environment and present the detection results in the form of a report. Read what it displays carefully and check to see if there is any software that has not yet been installed or if there are additional steps that need to be completed (usually in bold ).
The following problems usually occur during the first installation:
[-] Android toolchain - develop for Android devices
• Android SDK at D:\Android\sdk
✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
• Try re-installing or updating your Android SDK,
visit https://flutter.cn/docs/setup/#android-setup for detailed instructions.
This is because we have not configured the corresponding Android development environment. Next, configure the Android environment.
2. Configure the Android environment
-
Download and install Android Studio .
-
Run Android Studio and go into settings to configure the Android SDK version you want to run.
-
'Android Studio Setup Wizard', which will install the latest Android SDK, Android SDK Platform-Tools and Android SDK Build-Tools, which are required when developing Android Flutter applications. You also need to install the Android Emulator to start the Android virtual machine in vscode.
-
Run
flutter doctor
Make sure Flutter has located the installation location of your Android Studio. If Flutter is not located, run toflutter config --android-studio-dir <directory>
set your Android Studio installation directory.
3. Configure Android devices in Android Studio
3.1 Enter Device Manager to configure Android devices
3.2 Create an Android virtual machine
3.3 Select x86 image
3.4 Configure hardware acceleration
3.5 Start the emulator
4. Configure vscode
1. Install Flutter and Dart plug-ins
-
Open VS Code.
-
Open View > Command Palette… .
-
Type "install" and select Extensions: Install Extensions .
-
Enter "flutter" in the extended search input box, then select Flutter in the list and click Install . The necessary Dart plugins are automatically installed during this process.
-
Click Reload to Activate to restart VS Code.
Or click Extension directly on the left side of vscode
-
Just install the flutter library (dart library will be added automatically)
5. Create a new flutter program
Create app
-
Open View > Command Palette .
-
Enter "flutter" and select Flutter: New Project .
-
Select Application .
-
Create a new or select the upper directory where the new project will be stored.
-
Enter a project name, for example
my_app
, and hit Enter . -
Wait for the project to be created and
main.dart
the file to appear in the editor.
This command will create a file named myapp
, which contains a simple sample program using the Material component .
6. Start the program
1. Select which emulator to start
2. Start
Press F5 or start in the upper right corner, you can see that the simulator is debugging the initial code