flutter 环境配置 for Mac Os

flutter 中文官网

https://flutterchina.club/setup-macos/

按这个可以装完环境。

对于 iOS 相关部分 xcode工具和vscode 工具的安装不作说明。

 

1.下载flutter SDK https://flutter.dev/docs/development/tools/sdk/archive?tab=macos#macos

   使用  git clone -b master https://github.com/flutter/flutter.git

下载到本机某个文件夹,具体自行定义啦。

2.设置好flutter 的国内镜像环境变量。

vim .bash_profile

添加

#国内用户需要设置

export PUB_HOSTED_URL=https://pub.flutter-io.cn

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

export PATH=/Users/a/Documents/flutter/sdk/flutter/bin:$PATH

基中/Users/a/Documents/flutter/sdk/flutter/bin这个就是你第一步git 克隆下来的具体位置路径。

3.执行 flutter doctor            //这个命令取的真好,有意思哈。医生。作用就像医生一样,执行后帮你检测当前的环境是否OK。

我第一次执行的日志:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.3.11-pre.39, on Mac OS X 10.14 18A391, locale
    zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    ✗ 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.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2018.1.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.32.0)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

! Doctor found issues in 6 categories.

 

 可以看到 iOS和vscode都还不ok.

 3.装ios 连接。

    按医生叮嘱的来做。

        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

4.对vscode安装flutter插件。记得安装完成后需要重起。

vscode安装插件这个应该会吧。

安装完成后在命令行面板(command palette) shift+command+p 中输入 flutter

接着要求输出项目名称:按教程来先。myapp

生成myapp的目录结构如下:

然后打开debug 下进行配置

然后点绿色run.如果ios的模拟器打开了就会跑起来了。

真机配置:

到我们myapp的目录:

用xcode打开workspace文件。然后配置相关证书就OK了。配置后,插上真机就可以直接跑了。这个配置对于懂ios开发工具的就下当简单,非ios开发的话,可能会被证书搞蒙。

保存回到vscode中,插上真机运行。

真机的运行效果。好了。今天就到这。

 

 

 

 

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

边缘998

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值