Flutter:mac os10上搭建环境

环境:黑苹果系统10,xcode版本10,flutter版本1.7.8;

1.设置源:

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

打开环境变量open ~/.bash_profile,将以上内容粘贴,然后更新source ~/.bash_profile

2.下载flutter sdk:

git clone https://github.com/flutter/flutter.git;(flutter版本需要对应xcode版本)


3.配置环境变量:

export PATH=[flutter sdk目录]/flutter/bin:$PATH;


4.创建项目:

flutter create flutterapp;


5.运行:
cd flutterapp
flutter run


6.也可以通过flutterapp/ios/Runner.xcodeproj打开项目,再运行;

 

7.注意事项:

(1).CocoaPods pod setup无法初始化:下载:https://github.com/CocoaPods/Specs;重命名为master;放到/.cocoapods/repos/文件夹下;
(2).安装brew:https://files-cdn.cnblogs.com/files/duanweishi/brew_install.sh;通常会卡在 tapping homebrew/core ,没关系, 执行如下命令即可:git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

ios上编译时出错:could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debu...
解决办法:
1、保证在下面根目录下执行下面:flutter clean
2、然后cd到ios目录执行下面:cd ios
3、最后执行这一步:pod install

 

你可能感兴趣的:(Flutter)