在安装过sdk之后,如果想更换路径,
1、首先在系统目录下找到.bash_profile文件,右键选择打开方式为文本编辑,修改里面的路径之后保存,较新的 mac系统还有一个 .zshrc也修改,内容保持和.bash_profile内容文件一样就行。
或者直接在终端输入open -a TextEdit ~/.bash_profile一样能修改
Flutter修改SDK路径 - Mac
Flutter修改SDK路径 - Mac

2、修改android studio路径
Flutter修改SDK路径 - Mac
如果只修改了步骤1,可能会报以下错误

Warning! The ‘flutter’ tool you are currently running is from a different Flutter repository than the one last used by this package. The repository from which the ‘flutter’ tool is currently executing will be used instead.
running Flutter tool: /Users/edz/Documents/tools/flutter/sdk/flutter
previous reference : /Users/edz/Documents/tools/flutter/sdk22/flutter
This can happen when you have multiple copies of flutter installed. Please check your system path to verify that you are running the expected version (run ‘flutter --version’ to see which flutter is on your path).

修改完记得重启 android studio,使用 flutter --version 命令查看 flutter 版本是否修改成功

相关文章: