美文网首页
在macOS上搭建Flutter开发环境

在macOS上搭建Flutter开发环境

作者: 骑马纵天下 | 来源:发表于2019-07-31 15:36 被阅读0次

Flutter中文网教程一般按照上面流程装基本没问题,下面是博主安装时遇到的问题,以及安装流程。

1. 自行百度或者google下载Xcode和Android Studio
2. Flutter SDK下载稳定版的。
3. 下载过后可以手动或者通过终端解压,安装到你指定的目录。
* 安装到哪都行,只要记得安装的位置。我是安装到文稿里面,通过终端`cd ~/development`到文稿目录下,然后解压缩安装。
* 直接在终端敲出`unzip`命令然后把下载的Flutter安装包拖进去,回车。
* 安装完成后需要把`Flutter`路径添加到环境变量中。
    *  通过`defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder`命令显示`.bash_profile`文件

    * 把`Flutter`安装路径放里面,找到`flutter`安装位置把里面的`bin`拖到终端,能显示地址。我的地址是`/Users/huanghaipo/Documents/flutter/bin`。

    * 把下面的镜像也放里面保存,谷歌提供的在国内可以访问的镜像,可能会改,访问官网找找就行。
export PATH=上面Flutter我的地址 自己安装flutter路径:$PATH

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
4. 运行flutter doctor检查。
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8 hotfix.4, on Mac OS X 10.14.5 18F132, locale
    zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 10.2.1)
    ! 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
[✗] 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
[!] Android Studio (version 3.4)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.36.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (1 available)

! Doctor found issues in 4 categories.


Android Studio 3.4.1
Build #AI-183.6156.11.34.5522156, built on May 2, 2019
JRE: 1.8.0_152-release-1343-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.5

其中第一个X按照提示安装即可。
第二和第三个X是检测到我电脑上装了支持开发flutter的但是没有安装flutter插件,只需去安装就行。
!号,看心情,强迫症就修复

问题:
Android Studio插件有问题,访问不了,vpn打开也不行。估计是服务器问题。
晚上可以访问了,VPN都没开,问题是速度还挺快。服务器估计闹情绪了,如果在安装插件时,搜索不到插件,不要急可以先用别的IDE比如VS Code

相关文章

网友评论

      本文标题:在macOS上搭建Flutter开发环境

      本文链接:https://www.haomeiwen.com/subject/vcrtdctx.html