[TOC]
安装
本文以Mac系统为例
访问官网安装:
https://flutter.dev/docs/get-started/install/macos
下载SDK包flutter_macos_v1.2.1-stable.zip
命令行执行下面几个步骤:
|
|
doctor提示问题
|
|
解决中遇到的问题
1,运行precache很慢
|
|
解决方案
|
|
2,更新brew很慢
解决方案
使用中科大的镜像替换默认源
第一步,替换brew.git
12➜ cd "$(brew --repo)"➜ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git第二步:替换homebrew-core.git
12➜ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"➜ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git最后使用下面命令进行更新,发现速度变的很快。替换镜像完成。
1➜ brew update
3,brew遇到SSL certificate problem
|
|
解决方案
|
|
4,android-licenses长时间没有反应
|
|
解决方案
|
|
5,Install the Flutter and Dart plugins
Android Studio 解决方案
To install these:
- Start Android Studio.
- Open plugin preferences (Preferences > Plugins on macOS, File > Settings > Plugins on Windows & Linux).
- Select Browse repositories, select the Flutter plugin and click Install.
- Click Yes when prompted to install the Dart plugin.
- Click Restart when prompted.
VSCode 解决方案
- Start VS Code.
- Invoke View > Command Palette….
- Type “install”, and select Extensions: Install Extensions.
- Type “flutter” in the extensions search field, select Flutter in the list, and click Install. This also installs the required Dart plugin.
VSCode Validate your setup with the Flutter Doctor
- Invoke View > Command Palette….
- Type “doctor”, and select the Flutter: Run Flutter Doctor.
- Review the output in the OUTPUT pane for any issues.
6,Android SDK版本不匹配
|
|
解决方案
- 点击androidStudio菜单的Settings
- 点击Appearance&Behavior
- 点击System Settings
- 安装Android SDK 28
最后所有诊断都通过
|
|
7. 新建flutter项目flutter Resolving dependencies…很慢
打开和新建flutter项目时发现,flutter Resolving dependencies…很慢。
解决办法:
打开Flutter SDK:flutter\packages\flutter_tools\gradle\flutter.gradle
改为以下即可解决!123456789101112buildscript { repositories { // google() // jcenter() maven{ url 'https://maven.aliyun.com/repository/google' } maven{ url 'https://maven.aliyun.com/repository/jcenter' } maven{url 'http://maven.aliyun.com/nexus/content/groups/public'} } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' }}