1.flutter环境变量设置
1. flutter中国镜像临时环境可以去官网去查看有没有替换
https://docs.flutter.dev/community/china
open ~/.bash_profile
设置环境变量如下
export PATH
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
**export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
#**添加**flutter**相关工具到**path
export FLUTTER_ROOT=/Users/lx/Desktop/zhangfanglinProject/flutter/flutter
export PATH=${PATH}:$FLUTTER_ROOT/bin:$PATH
#**添加**dart**相关工具到**path
export DART_ROOT=/Users/lx/Desktop/zhangfanglinProject/flutter/flutter/cache/dart-sdk
export PATH=${PATH}:$DART_ROOT/bin:$PATH
#gradle
export G_HOME=/usr/local/Cellar/gradle/7.1.1
export PATH=$PATH:$G_HOME/bin
#Flutter**镜像
#**国内用户需要设置
export PUB_HOSTED_URL=https://pub.flutter-io.cn
#**国内用户需要设置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
#adb
export ANDROID_HOME=/Users/lx/Library/Android/sdk
export PATH=${PATH}:/Users/lx/Library/Android/sdk/platform-tools
export PATH=${PATH}:/Users/lx/Library/Android/sdk/tools
2.获取flutter的**SDK
1.**去**github**,或者**gitee**上去拉去**git**。然后确定到哪一个版本号的使用。
https://gitee.com/mirrors/Flutter.git
2.**或者去官网去下载。
https://docs.flutter.dev/development/tools/sdk/releases
3.**环境变量配置好,然后flutter doctor 检测。
2.flutter 项目创建
1.**创建**flutter**项目,可以终端创建。flutter create project
3.androidstudio的镜像或者官网去下载。
(https://developer.android.google.cn/studio)中国镜像去下载。
(https://developer.android.com/studio)
(https://developer.android.google.cn/studio/intro)中文文档
4.hosts配置
vi /etc/hosts
*20.205.243.166 raw.githubusercontent.com*
*#199.232.4.133 raw.githubusercontent.com*
*#140.82.114.3 https://github.com*
*140.82.112.3* [*https://github.com*](https://github.com)
网友评论