Beginner Flutter
install flutter-windows
Edit environment variables
-
In
用户变量
the column, check forPath
this entry: -
If this entry exists,
;
separate and addflutter\bin
the full path to the directory. -
If it does not exist, create a new
Path
variable , and then useflutter\bin
the full path where is the value of the new variable.
runflutter doctor
Check flutter version
flutter --version
Problem Summary
Unable to confirm if installed Windows version is 10 or greater (cannot confirm whether the installed Windows version is greater than or equal to 10)
There is still a problem with installing dart
#查看自己的flutter channel版本
flutter channel
#flutter channel stable#将flutter版本切换为stable
flutter channel master#将flutter版本切换为master
#确保flutter更新到了最新版本
flutter upgrade
#再次检查是否解决
flutter doctor
There is still an error, but this
Unable to confirm if installed Windows version is 10 or greater
issue has been resolved
Android toolchain - develop for Android devices X Unable to locate Android SDK.
- Right-click My Computer on the desktop>Properties>Advanced System Settings>Environment Variables>New in User Variables
ANDROID_HOME
, the variable value isAndroid SDK(我这里是D:\Feil\SDK\Android)
the path
After setting, restart the computer
flutter doctor
cmdline-tools component is missing
download this
flutter doctor
Google\Chrome路径
is not executable.
If it still doesn't work after adding
flutter config --android-sdk /path/to/android/sdk
Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
MicroSoft Edge
We have to install a chrome because I use
flutter doctor
Visual Studio not installed; this is necessary for Windows development.
flutter doctor
A network error occurred while checking “https://pub.dev/”: The semaphore timeout has expired&&A network error occurred while checking “https://maven.google.com/”: The semaphore timeout has expired
re-install
flutter sdk
Configure domestic mirroring
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
PUB_HOSTED_URL=https://pub.flutter-io.cn
Unable to find bundled Java version.
method 1
Method 2
Or
jbr
copy the files in the AndroidStudio path/ tojre
the file in the picture above
If the error is still reported in this way, you can consider reinstalling
AndroidStudio
, and then follow the above two methods to solve the problem
flutter HTTP Host availability check is taking a long time…[!] HTTP Host Availability
- Find
flutter sdk
the file directory, findflutter/packages/flutter_tools/lib/src/http_host_validator.dart
the file in turn https://maven.google.com/
Change tohttps://dl.google.com/dl/android/maven2/
- Close all open
flutterSDK
programs, findflutter\bin
the one in the directoryflutter_tools.snapshot文件
, and delete it permanently .
flutter doctor
Android license status unknown.
flutter doctor --android-licenses
Error: A JNI error has occurred, please check your installation and try again
The versions of Java and JDK are different. View the java path
which java #Linux下
where java #Windows下
Edit under windows环境变量
java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Copy a copy of the JDK file to your
Andriod Stduio
folderjre
(withbin目录
the same level)
Note that if you are
JDK1.8
the version, it will still report this error.JDK11
It is feasible for me to use
the picture of successful installation
Or
jre
the directory exists, but there is almost nothing in it, you can directly copyjbr
all the files in the directory tojre
the directory
'choco'
is not recognized as an internal or external command, operable program or batch file.
- Open powershell (administrator)
- execute this command
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Change ChocolateyToolsLocation
the environment variable to choose the installation directory
- Increase in system environment variables
ChocolateyInstall
Open powershell (administrator)
#D:\File\SDK\Chocolatey:只是存放目录,可以完全自定义修改
& setx.exe ChocolateyInstall D:\File\SDK\Chocolatey /M
refreshenv
Then you can see the environment variables
Install the Dart SDK (not recommended)
choco install dart-sdk
Install the Dart SDK (recommended)
Add environment variables
dart --version
vscode - Dart
void main(List<String> args) {
var num = 42;
print(num);
}
Successful installation picture
AndriodStudio creates Flutter
Install the plugin and restart the application
Vscode creates a Flutter application
Refer to the documentation
Flutter and restart VS Code
command to run
flutter run
Effect