我们的Android Studio开发工具安装了Flutter插件之后,本地还需要安装Flutter SDK,因为我们的开发工具在新建目录时需要指向这个Flutter SDK,那么如何安装最新版Flutter SDK呢?请看教程。
1:使用git命令Flutter Sdk
注意:Flutter官方并不建议将Flutter SDK安装在C盘上,因为它要请求一些特殊权限
如果你windows或macos上没有git的话,请参照此处安装:电脑上安装git教程,然后运行如下命令:
C:\src>git clone https://github.com/flutter/flutter.git -b stable
使用git命令下载安装Flutter SDK的好处就是它会将最新稳定版的flutter和与之相匹配的dart版本一起下载下来,如果已经下载了,它也会自动帮你升级。
2:检查Flutter版本
进入到Flutter SDK的目录,输入如下命令:
C:\src\flutter>flutter doctor-v
会提示Flutter版本信息,如下:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.6, on Microsoft Windows [Version 10.0.17763.805], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected device (1 available)
3:安装FlutterSDK可能出现的问题,如一直卡在”Running pub upgrade...“上,则:
点击链接解决一直停留在Running pub upgrade...上的问题