Flutter learning journey (1)

Beginner Flutter

Flutter official website and Chinese development manual

install flutter-windows

Official Documentation-windows

flutter_windows_3.7.9-stable.zip

Edit environment variables

  • In 用户变量the column, check for Paththis entry:

  • If this entry exists, ;separate and add flutter\binthe full path to the directory.

  • If it does not exist, create a new Pathvariable , and then use flutter\binthe full path where is the value of the new variable.
    Own flutter sdk path

runflutter doctor

insert image description here

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 

my flutter channel

#flutter channel stable#将flutter版本切换为stable
flutter channel master#将flutter版本切换为master

Switch flutter version to master

#确保flutter更新到了最新版本
flutter upgrade

Check that flutter is updated to the latest version

#再次检查是否解决
flutter doctor 

windows version is ok

There is still an error, but this Unable to confirm if installed Windows version is 10 or greaterissue has been resolved

Android toolchain - develop for Android devices X Unable to locate Android SDK.

This is the path map of AbdroidSDK

  • Right-click My Computer on the desktop>Properties>Advanced System Settings>Environment Variables>New in User Variables ANDROID_HOME, the variable value is Android SDK(我这里是D:\Feil\SDK\Android)the path
    insert image description here

After setting, restart the computer

flutter doctor

Android toolchain - develop for Android devices  X Unable to locate Android SDK. is OK

cmdline-tools component is missing

insert image description here

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 EdgeWe have to install a chrome because I use

chrome user variables

flutter doctor

Visual Studio not installed; this is necessary for Windows development.

Visual Studio

The version I downloaded

Detailed pictures downloaded by vsStudio (C++ desktop 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

Using Flutter in the Chinese network environment

my zip file

re-installflutter sdk

Configure domestic mirroring
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
PUB_HOSTED_URL=https://pub.flutter-io.cn

windows-FLUTTER_STORAGE_BASE_URL placement
windows-PUB_HOSTED_URL placement

Unable to find bundled Java version.

method 1

reference article

All files of JDK
Under the jre folder of the Android installation directory

Method 2

Or jbrcopy the files in the AndroidStudio path/ to jrethe 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

reference article

  1. Find flutter sdkthe file directory, find flutter/packages/flutter_tools/lib/src/http_host_validator.dartthe file in turn
  2. https://maven.google.com/Change tohttps://dl.google.com/dl/android/maven2/
    edited image
  3. Close all open flutterSDKprograms, find flutter\binthe one in the directory flutter_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 Stduiofolder jre(with bin目录the same level)

Note that if you are JDK1.8the version, it will still report this error. JDK11It is feasible for me to use
the picture of successful installation

Successful installation picture

Or jrethe directory exists, but there is almost nothing in it, you can directly copy jbrall the files in the directory to jrethe directory

'choco'is not recognized as an internal or external command, operable program or batch file.

  1. Open powershell (administrator)
  2. 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 ChocolateyToolsLocationthe environment variable to choose the installation directory

  • Increase in system environment variablesChocolateyInstall

Open powershell (administrator)

#D:\File\SDK\Chocolatey:只是存放目录,可以完全自定义修改
& setx.exe ChocolateyInstall D:\File\SDK\Chocolatey /M
refreshenv

Then you can see the environment variables
Diagram of the environment - chocolateInstall

Install the Dart SDK (not recommended)

choco install dart-sdk

dart-sdk location (related to changing ChocolateyToolsLocation)

Install the Dart SDK (recommended)

Dart for Windows

Add environment variables

insert image description here

dart --version

dart --version graph

vscode - Dart

Vscode installs the Dart plugin

vscode installs the Code Runner plugin

void main(List<String> args) {
    
    
  var num = 42;
  print(num);
}

Successful installation picture

Successful installation

AndriodStudio creates Flutter

Install the plugin and restart the application

install plugin
New Fluter Project appears
FlutterSDK path

Vscode creates a Flutter application

Refer to the documentation
Install Flutter in the plug-in market
Flutter and restart VS Code
Flutter: Run Flutter Doctor
Flutter:New Project
Application
Basic project file picture
Prompt to run on the platform

command to run

flutter run

flutter run platform selection

Effect
renderings

Guess you like

Origin blog.csdn.net/yasinawolaopo/article/details/129932216