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查看問題