flutter_app打開(kāi)后,找不到設(shè)備(模擬器、真機(jī))
一、配置環(huán)境變量
$ export PATH=$PATH:/Library/flutter/bin
二、運(yùn)行run flutter doctor
$ flutter doctor
運(yùn)行結(jié)果:
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G65, locale
zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
? Android licenses not accepted. To resolve this, run: flutter doctor
--android-licenses
[!] iOS toolchain - develop for iOS devices
? 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
? 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 with Brew:
brew install ios-deploy
! CocoaPods out of date (1.5.0 is recommended).
CocoaPods is used to retrieve the iOS platform side's plugin code that
responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work
on iOS.
For more info, see https://flutter.io/platform-plugins
To upgrade:
brew upgrade cocoapods
pod setup
[?] Android Studio
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
[?] Android Studio (version 3.2)
[!] IntelliJ IDEA Ultimate Edition (version 2017.1.6)
? Flutter plugin not installed; this adds Flutter specific functionality.
? Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
! Doctor found issues in 4 categories
三、問(wèn)題解決
從運(yùn)行結(jié)果可以看出有[!]標(biāo)識(shí)的都是有問(wèn)題的選項(xiàng)。
1、更新command-line

圖片.png
2、執(zhí)行以下命令
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
3、查看Android Studio工具,現(xiàn)在已經(jīng)可以找到iPhone模擬器了,使用模擬器已經(jīng)可以正常運(yùn)行
4、安裝homebrew
5、確保homebrew是最新版本
$ brew update
6、執(zhí)行以下命令
$ brew install --HEAD usbmuxd
$ brew link usbmuxd
$ brew install --HEAD libimobiledevice
$ brew install ideviceinstaller ios-deploy cocoapods
$ pod setup
7、打開(kāi)Android Studio設(shè)備切換為真機(jī),運(yùn)行成功