Construction of Flutter environment
The local environment
- Widnwos 7 64
- IntelliJ IDEA 2017.2.6
- Java 1.8
- Gradle 4.8.1
- Git
- Android SDK
1. Download the Android SDK through IDEA
1File | Settings | Appearance Behavior | System Settings | Android SDKCopy the code
Remember to download an Android image
Configure the AdnroidSDK environment variables
1ANDROID_HOME=D:\AndroidSDK 2 3 here D:\AndroidSDK should be replaced with your own local pathCopy the code
Download the Flutter SDK
Configure environment variables:
1PUB_HOSTED_URL=https://pub.flutter-io.cn
2FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cnCopy the code
Download Flutter using Git
1git clone -b beta https://github.com/flutter/flutter.gitCopy the code
Configure the environment variable of the Flutter by adding the path of the Flutter directly after the path environment variable
To check the flutter installation, execute flutter Doctor on the command line
1flutter doctor 2 3Doctor summary (to see all details, run flutter doctor -v): 4[√] Flutter (Channel Beta, V0.5.1, on Microsoft Windows [Version 6.1.7601], Locale zh-CN) 5[√] Android Toolchain - Develop for Android Devices (Android SDK 28.0.0-rc2) 6[X] Android Studio (not Installed) 7[√] IntelliJ IDEA Ultimate Edition (Version 2017.2) 8[!] Connected devices 9 ! No devices available 10 11! Doctor found issues in 2 categories. 12 13 14 15Copy the code
If you have something like this:
1[qualify] Android Toolchain - Develop for Android Devices 2 University Unable to locate Android SDK. 3 Install Android Studio from: https://developer.android.com/studio/index.html 4 On first launch it will assist you in installing the Android SDK components. 5 (or visit https://flutter.io/setup/#android-setup for detailed instructions). 6 If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.Copy the code
There is no Android SDK or environment variable configured for $ANDROID_HOME
3. The configuration IDEA
Install Dart and Flutter plug-ins. You need to restart after the installation.
Note: It is better to open IDEA with administrator privileges, otherwise there will be a series of problems later
Create a FLUTTER project. Create an Android emulator.
If you’re lucky enough to be running at this point, don’t look down.
When I got here, I created an Android emulator, but it kept telling me when I clicked to run
1No connected devices found; please connect a device, or see flutter.io/setup for getting started instructions.Copy the code
Use administrator rights to open no problem!
4. Gradle pit
The emulator should now be displayed, stopping at Initializing Gradle while running.
1Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
2Initializing gradle...Copy the code
Check Gradle’s environment variables. If not, you need to configure it
1GRADLE_HOME=D:\tools\gradle-4.8.1 2 Append the path environment variable; %GRADLE_HOME%\binCopy the code
Open IDEA with administrator privileges
If not, run the following command with IDEA Terminal
1cd Android 2gradlew 3 4 5 6 7E:\workspace\hello_flutter>cd android 8E:\workspace\hello_flutter\android>gradlew 9 10> Configure project :app 11File C:\Users\unicom\.android\repositories.cfg could not be loaded. 12Checking the license for package Android SDK Platform 27 in D:\AndroidSDK\licenses 13License for package Android SDK Platform 27 accepted. 14Preparing "Install Android SDK Platform 27 (revision: 3)". 15"Install Android SDK Platform 27 (revision: 3)" ready. 16Installing Android SDK Platform 27 in D:\AndroidSDK\platforms\android-27 17"Install Android SDK Platform 27 (revision: 3)" complete. 18"Install Android SDK Platform 27 (revision: Task: Help 21 22Welcome to Gradle 4.1. 23 24To run a build, run gradlew < Task >... 25 26To see a list of available tasks, run gradlew tasks 27 28To see a list of command-line options, run gradlew --help 29 30To see more detail about a task, run gradlew help --task <task> 31 32 33BUILD SUCCESSFUL in 1m 0s 341 actionable task: 1 executed 35E:\workspace\hello_flutter\android>flutter doctor 36Doctor summary (to see all details, run flutter doctor -v): 37[√] Flutter (Channel Beta, V0.5.1, on Microsoft Windows [Version 6.1.7601], [√] Android Toolchain-develop for Android Devices (Android SDK 28.0.0-rc2) 39[X] Android Studio (not 41[√] IntelliJ IDEA Ultimate Edition (Version 2017.2) 41[!] Connected devices 42 ! No devices available 43 44! Doctor found issues in 2 categories. 45Copy the code
Click Run again. I successfully ran it on the simulator.
If it still can’t run: append the CLASS_PATH environment variable:; %GRADLE_HOME%\lib
PS: I have to say that Flutter is too unfriendly to Windows users.
The best place to learn a new technology is in the Issues area on Github.
Link to this article: zdran.com/20180625.ht…