一.? Mac环境下Flutter环境搭建
1. ?首先去官网下载 Flutter SDK?下载以下安装包以获取Flutter SDK的最新稳定版本:
Flutter SDK releases | FlutterAll current Flutter SDK releases, stable, beta, and master.https://docs.flutter.dev/development/tools/sdk/releases?tab=macos
我这里下载的是3.0.5稳定版最新版本为例:flutter_macos_arm64_3.0.5-stable? ??
2. 将文件提取到所需位置进行解压:
?cd /Users/guo/flutter3.0.5_arm64_stable ?unzip ? /Users/guo/flutter3.0.5_arm64_stable/flutter_macos_arm64_3.0.5-stable.zip?
3. 打开环境变量配置文件进行环境变量的配置 (需要配置flutter与Dart)
3.1 终端执行命令cd ~/? 首先要在终端执行回到用户根目录,执行pwd 查看当前所处目录?
Mac:~ guo$ pwd
/Users/guo
3.2 终端执行命令
open -e .bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn export PATH=$PATH:/Users/guo/flutter3.0.5_arm64_stable/flutter/bin
export DART_HOME=/Users/guo/flutter3.0.5_arm64_stable/flutter/bin/cache/dart-sdk/bin export PATH="${DART_HOME}:${PATH}"
保存文件,并执行 ? source ~/.bash_profile? 使配置生效
4. 执行 flutter doctor ?命令进行查看配置是否成功
二、Android Studio插件配置
1.打开Android Studio的preferences,在Plugins中查找 Dart、Flutter ,install 执行安装,然后重新启动 Android Studio
2. 重新启后在File菜单项就可见?New Flutter Project?
3. 在Android ?studio 中可以启动 iOS Simulator但无法连接的解决方法
在终端中执行下面命令,然后重新打开点击运行即可启动 simulator并打开模拟器进行调试
?sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer?
|