使用镜像
PUB_HOSTED_URL=https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
下载SDK
- 去flutter的官网下载: https://flutter.dev/docs/get-started/install
- GitHub下载:https://github.com/flutter/flutter/releases
添加path
将下载的flutter
的SDK
包解压放在你要安装的目录下,找到bin
文件夹并复制路径,然后将这个路径添加到path
中。
在命令行运行flutter doctor
运行flutter doctor
报错
-
需要运行
flutter doctor --android-licenses
错误信息:
Android toolchain - develop for Android devices (Android SDK version 28.0.3) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
解决错误:在命令行运行
flutter doctor --android-licenses
运行结果部分截图: -
Android Studio
需要安装Flutter和Dart
错误信息:
Android Studio (version 3.4) X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality.
解决错误:
打开Android Studio
点击Tools
选择SDK Manger
,进入设置页面,选择Plugins
,可以看到如下的页面,在红色标出的地方搜索并安装Flutter和Dart
(安装完成后重启Android Studio
)。
-
VS Code
需要安装Flutter
错误信息:
VS Code, 32-bit edition (version 1.40.2) X Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
解决错误:
打开VS Code
在扩展商店搜索Flutter
并安装(安装Flutter
时Dart
会被自动安装)。