Flutter 环境问题

关键字

! No devices available
Error: No such keg: /usr/local/Cellar/libimobiledevice
Warning: usbmuxd HEAD-c75605d_1 is already installed and up-to-date
To reinstall HEAD_1, run brew reinstall usbmuxd


➜  ~ flutter doctor -v
[✓] Flutter (Channel master, v1.2.1-pre.194, on Mac OS X 10.14.3 18D109, locale
    zh-Hans-CN)
    • Flutter version 1.2.1-pre.194 at /Users/conan/flutter_sdk/flutter
    • Framework revision 537b592ed5 (20 hours ago), 2019-02-13 20:17:28 -0800
    • Engine revision d48de7a3ec
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 fdfe40ea95)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/conan/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling
      support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    ✗ 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 1.9.4
    • CocoaPods version 1.6.0

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 32.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build
      1.8.0_152-release-1248-b01)

[!] IntelliJ IDEA Ultimate Edition (version 2018.3.4)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.io/intellij-setup/#installing-the-plugins

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

由于手残将电脑重装了,导致环境得重新配置,sdk更新了几次之后好像也出现过找不到设备的问题,现在统一解决了,特地记录下,免得自己忘记,如果有遇到和我一样问题的,可以尝试下试试。

出现上面的问题,正常按照提示输入命令应该就可以解决问题,但是本人电脑就是不行; 下面是记录,最后也会给出总结。

运行这个命令的时候 出现如下warning ,紧接着运行brew reinstall usbmuxd 也并没有什么作用
➜  ~ brew install --HEAD usbmuxd
Warning: usbmuxd HEAD-c75605d_1 is already installed and up-to-date
To reinstall HEAD_1, run `brew reinstall usbmuxd`

完整的命令和日志:

➜  ~ brew install --HEAD usbmuxd
Warning: usbmuxd HEAD-c75605d_1 is already installed and up-to-date
To reinstall HEAD_1, run `brew reinstall usbmuxd`

➜  ~ brew reinstall usbmuxd
==> Reinstalling usbmuxd 
==> Cloning https://git.sukimashita.com/libusbmuxd.git
Updating /Users/conan/Library/Caches/Homebrew/usbmuxd--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at c75605d Return meaningful error codes from usbmuxd_connect()
==> ./autogen.sh
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/usbmuxd/HEAD-c
==> make install
🍺  /usr/local/Cellar/usbmuxd/HEAD-c75605d_1: 13 files, 138.1KB, built in 54 seconds

➜  ~ brew install --HEAD usbmuxd
Warning: usbmuxd HEAD-c75605d_1 is already installed and up-to-date
To reinstall HEAD_1, run `brew reinstall usbmuxd`
➜  ~ 

上面出现的情况,发现使用提示去操作并无任何作用,最后在Github flutter issues上找到了解决办法.

总结解决 连接iOS 设备问题:

        brew update
        brew install --HEAD usbmuxd
        brew unlink usbmuxd  //解决我的问题的关键命令
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller

最终结果

➜  ~ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.2.1-pre.194, on Mac OS X 10.14.3 18D109, locale
    zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2018.2.7)
[✓] Connected device (1 available)

• No issues found!

iOS toolchain: 运行到iOS真机设备需要开发者证书
IntelliJ IDEA:破解方法

2019 03-20 补充异常问题
对于之前安装过,后面更新又出现问题的情况,这里记录些自己遇到的现象,和解决办法;经过经历这么多问题,感觉flutter 的文档还是特别好用的,安装有问题都有提示,提示你该怎么操作;
问题一:libimobiledevice–git clone 不了

==> Summary
🍺  /usr/local/Cellar/libxml2/2.9.9_2: 281 files, 10.5MB
==> Installing libimobiledevice --HEAD
==> Cloning https://git.libimobiledevice.org/libimobiledevice.git
Cloning into '/Users/zhangwenhao/Library/Caches/Homebrew/libimobiledevice--git'...
fatal: unable to access 'https://git.libimobiledevice.org/libimobiledevice.git/': Empty reply from server
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "libimobiledevice"
Failure while executing; `git clone --branch master https://git.libimobiledevice.org/libimobiledevice.git /Users/zhangwenhao/Library/Caches/Homebrew/libimobiledevice--git` exited with 128. Here's the output:
Cloning into '/Users/zhangwenhao/Library/Caches/Homebrew/libimobiledevice--git'...
fatal: unable to access 'https://git.libimobiledevice.org/libimobiledevice.git/': Empty reply from server



➜  ~ /Users/zhangwenhao/Library/Caches/Homebrew/
➜  Homebrew ls    

解决办法:自己手动clone ,这里出现这个问题的原因是 github 上面该仓库换了路径;

➜  Homebrew git clone https://github.com/libimobiledevice/libimobiledevice.git libimobiledevice--git
Cloning into 'libimobiledevice--git'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 8261 (delta 14), reused 18 (delta 11), pack-reused 8234
Receiving objects: 100% (8261/8261), 2.56 MiB | 1.73 MiB/s, done. 
Resolving deltas: 100% (5793/5793), done.
➜  Homebrew cd  

后面再接着前面的操作继续;

    原文作者:老柯南
    原文地址: https://www.jianshu.com/p/a98fc596cb48
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞