Flutter安装完成以后运行flutter doctor ,出现一下问题,如图android
前提:Xcode 、Android Studio 、VS Code都已安装ios
问题1、Android toolchain - develop for Android device
1)Flutter requires Android SDK 28 and the Android BuildTools 28.0.3.xcode
根据提示更新s d k manager在终端执行run:后面的命令,例如浏览器
/User/Datacvg/Libary/Android/sdk/tools/bin/sdkmanager "platforms;android-28" "build-tools:28.0.3"app
执行以后在执行flutter doctor,此问题已经解决。ide
2)Android license not accepted.ui
一样执行run后面的提示:flutter doctor --android-licensesthis
以后就有相关提示(y/n)?一直y就能够。spa
执行flutter doctor查看,以下图所示:3d
问题2、iOS toolchain - develop for iOS devices (Xcode 9.4)
1)Xcode installation is incomplete; a full installation is necessary for iOS development.
执行run提示的命令:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
2)libimobiledevice and ideviceinstaller are not installed. To install with Brew问题
brew update 命令执行时间很长须要等待
brew install --HEAD usbmuxd 命令执行的时候会提示
Your Xcode (9.4) is too outdated.须要更新Xcode,更新以后继续刚才执行的提示命令
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
3)ios-deploy not installed. To install:
执行brew install ios-deploy
执行flutter doctor,查看,可能会出现新的错误以下图:
解决方法:
执行一下命令:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install --HEAD ideviceinstaller
brew link --overwrite ideviceinstaller
执行完成以后,执行flutter doctor 查看,以下图所示
问题3、Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
解决方法:
打开打开android studio中plugin,以下图
搜索fullter并点击Search in repositories,安装Flutter,以下图
安装完成以后,从新启动Android Studio。
问题4、 VS Code (version 1.33.1)
1) Flutter plugin not installed; this adds Flutter specific functionality.
在浏览器中打开提示连接https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
打开以后会提示安装,点击安装install提示是否容许打开VS Code,以下图:
点击容许会自动打开VS Code并提示安装,点击安装,以下图所示:
注意:点击容许以后打开VSCode,没有Flutter安装提示的状况,能够关闭VS Code 从新加载连接安装,点击容许,就会出现安装提示。安装后有扩展安装,能够安装
问题五 、Connected device
1)No devices available
方案1、前面的问题解决完成以后,从新链接手机并信任,或者直接打开模拟器,在执行flutter doctor查看。
方案2、这里是在第三个问题尚未解决的状况的方法
首先使用VS Code 建立一个flutter项目:
官方文档:https://flutterchina.club/get-started/test-drive/#vscode
建立应用
- 启动 VS Code
- 调用 View>Command Palette…(中文 查看>命令面板...)
- 输入 ‘flutter’, 而后选择 ‘Flutter: New Project’ action
- 输入 Project 名称 (如
myapp
), 而后按回车键 - 指定放置项目的位置,而后按蓝色的肯定按钮
- 等待项目建立继续,并显示main.dart文件
先打开模拟器或链接真机 (iOS和Android均可以)
运行应用程序
- 确保在VS Code的右下角选择了目标设备
- 调用Debug>Start Debugging(调试启动调试)
- 应用程序启动
以下图:
以后在终端输入flutter doctor查看问题