Flutter安装错误解决

2019-07-22

在mac上安装flutter,输入flutter doctor发现如下错误:
问题1:

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses

解决:

flutter doctor --android-licenses

问题2:

[!] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS
      development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    ! CocoaPods out of date (1.6.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade:
        brew upgrade cocoapods
        pod setup

解决:
在App Store中安装或者更新Xcode到最新版。
输入命令:brew install cocoapodspod setup

问题3 :flutter不是内部命令
解决:
打开 open .bash_profile
添加 export PATH="/Users/myname/fluttersdk/flutter/bin:$PATH"
得到

export PATH="/usr/local/opt/openssl/bin:$PATH"
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH="/Users/myname/fluttersdk/flutter/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

问题4: [✗] iOS tools - develop for iOS devices

[✗] iOS tools - develop for iOS devices
    ✗ libimobiledevice and ideviceinstaller are not installed. To install with
      Brew, run:
        brew update
        brew install --HEAD usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    ✗ ios-deploy not installed. To install:
        brew install ios-deploy

解决:

直接按照提示一个一个安装。

@2024  TCODE    津ICP备13002520号-4