Flutter iOS&Mac环境集成趟坑

Hello,Flutter

1、git clone https://github.com/flutter/flutter.git一直报下面的错

➜ flutter git clone https://github.com/flutter/flutter.git
Cloning into 'flutter'...
remote: Enumerating objects: 258251, done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

原因分析:因为没有科学上网,
解决方法:下载zip包解压然后git关联上库就行了

2、不管是flutter -h还是flutter doctor都不成功

image.png

原因分析:国内需要配置镜像
解决方法:在flutter文件下输入以下命令

 export PUB_HOSTED_URL=https://pub.flutter-io.cn
 export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
 git clone -b dev https://github.com/flutter/flutter.git
 export PATH="$PWD/flutter/bin:$PATH"

参考链接:https://flutter.dev/community/china
结果:flutter -h

flutter -h

flutter doctor

flutter doctor
因为只配置mac和iOS开发环境,只进行了xcode的操作,接上了测试手机,如图
flutter doctor

3、环境配置完成后,再创建Flutter工程模块,要不然各种zsh: command not found: flutter之类的问题,各种操作.bash_profile也无济于事

flutter create -t module my_flutter

你可能感兴趣的:(Flutter iOS&Mac环境集成趟坑)