[英]Hardcoded FLUTTER_ROOT in Runner.xcodeproj/project.pbxproj
I have a Flutter project which was created on one machine, pushed to GitHub and then pulled to another machine.我有一个 Flutter 项目,它是在一台机器上创建的,推送到 GitHub,然后拉到另一台机器上。 The project couldn't be built on the second machine because the directory for
FLUTTER_ROOT
referenced in ios/Runner.xcodeproj/project.pbxproj
is an absolute path from the first machine ( /Users/user1/flutter
).该项目无法在第二台机器上构建,因为
ios/Runner.xcodeproj/project.pbxproj
引用的FLUTTER_ROOT
目录是第一台机器 ( /Users/user1/flutter
) 的绝对路径。
In order to build the project on the second machine, I need to change the path in XCode to /Users/user2/development/flutter
.为了在第二台机器上构建项目,我需要将 XCode 中的路径更改为
/Users/user2/development/flutter
。
The .gitignore
file used is the one that IntelliJ auto created for a brand new Flutter project, and it obviously doesn't ignore ios/Runner.xcodeproj
.使用的
.gitignore
文件是 IntelliJ 自动为一个全新的 Flutter 项目创建的文件,它显然不会忽略ios/Runner.xcodeproj
。
I'm no expert, but I guess this file contains a lot of configurations one would want to keep in the repo, so ignoring it is not an option?我不是专家,但我想这个文件包含很多配置,人们希望保留在 repo 中,所以忽略它不是一种选择吗? What would be the best way to work around the issue of having different paths to the
flutter
directory on the two machines and still be able to work on the same remote Github repo?解决在两台机器上具有不同的
flutter
目录路径并且仍然能够在同一个远程 Github 存储库上工作的问题的最佳方法是什么?
Flutter root should be added in your terminal profile file ~/.zshrc or ~/.bash_profile instead of user defined in ios/Runner.xcodeproj/project.pbxproj file. Flutter root 应该添加到您的终端配置文件 ~/.zshrc 或 ~/.bash_profile 中,而不是在 ios/Runner.xcodeproj/project.pbxproj 文件中定义的用户。
So in your ~/.zshrc file, add export flutter root path like this所以在你的 ~/.zshrc 文件中,像这样添加导出颤振根路径
# flutter root
export PATH="/Users/user1/flutter/bin:$PATH"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.