Flutter框架安裝之后運行flutter doctor出現的問題


Flutter安裝完成之后運行flutter doctor ,出現一下問題,如圖

前提:Xcode 、Android Studio 、VS Code都已安裝

問題一、Android toolchain - develop for Android device 

1)Flutter requires Android SDK 28 and the Android BuildTools 28.0.3.

根據提示更新s d k manager在終端執行run:后面的命令,例如

/User/Datacvg/Libary/Android/sdk/tools/bin/sdkmanager "platforms;android-28" "build-tools:28.0.3"

執行之后在執行flutter doctor,此問題已經解決。

2)Android license not accepted.

同樣執行run后面的提示:flutter doctor --android-licenses

之后就有相關提示(y/n)?一直y就可以。

執行flutter doctor查看,如下圖所示:

問題二、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 查看,如下圖所示
  

問題三、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。

問題四、 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

  方案一、前面的問題解決完成之后,重新連接手機並信任,或者直接打開模擬器,在執行flutter doctor查看。

  

  方案二、這里是在第三個問題還沒有解決的情況的方法

  首先使用VS Code 創建一個flutter項目:

  官方文檔:https://flutterchina.club/get-started/test-drive/#vscode

  創建應用

  1. 啟動 VS Code
  2. 調用 View>Command Palette…(中文 查看>命令面板...)
  3. 輸入 ‘flutter’, 然后選擇 ‘Flutter: New Project’ action
  4. 輸入 Project 名稱 (如myapp), 然后按回車鍵
  5. 指定放置項目的位置,然后按藍色的確定按鈕
  6. 等待項目創建繼續,並顯示main.dart文件

  先打開模擬器或連接真機 (iOS和Android都可以)

  運行應用程序

  1. 確保在VS Code的右下角選擇了目標設備
  2. 調用Debug>Start Debugging(調試啟動調試)
  3. 應用程序啟動

  如下圖:

  

  之后在終端輸入flutter doctor查看問題

      

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM