flutter_app打开后,找不到设备(模拟器、真机)
一、配置环境变量
$ export PATH=$PATH:/Library/flutter/bin
二、运行run flutter doctor
$ flutter doctor
运行结果:
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
三、问题解决
从运行结果可以看出有[!]标识的都是有问题的选项。
1、更新command-line
图片.png
2、执行以下命令
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
3、查看Android Studio工具,现在已经可以找到iPhone模拟器了,使用模拟器已经可以正常运行
4、安装homebrew
5、确保homebrew是最新版本
$ brew update
6、执行以下命令
$ brew install --HEAD usbmuxd
$ brew link usbmuxd
$ brew install --HEAD libimobiledevice
$ brew install ideviceinstaller ios-deploy cocoapods
$ pod setup
7、打开Android Studio设备切换为真机,运行成功
网友评论