给mac系统配置flutter变量时碰到flutter命名找不到的问题。
- 打开命令行工具 输入
vim ./.bash_profile
// 或者
sudo vi ~/.bash_profile
2.然后编辑该文件, 输入i即可进入编辑模式,添加如下命令“
// 这里是flutter安装的路径,每个人会有差异,找到自己正确的路径
export PATH=/Users/admin/Downloads/flutter/flutter/bin:$PATH
3.保存 .bash_profile
文件:按键盘上的ESC退出编辑模式,然后输入:wq
保存并退出文件
此时全局环境变量已经配置成功,可以在命令行输入flutter doctor 命令,这时候会看到相关信息。
MacBook-Pro ~ % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale
zh-Hans-CN)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[!] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.63.2)
[✓] Connected device (1 available)
! Doctor found issues in 3 categories.
网友评论