简体   繁体   English

在 Runner.xcodeproj/project.pbxproj 中硬编码 FLUTTER_ROOT

[英]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.

相关问题 XCode - 编辑xcodeproj包(特别是project.pbxproj) - XCode - Editing xcodeproj bundle (specifically project.pbxproj) git-试图合并,但在xcodeproj / project.pbxproj中发生冲突 - git - tried to merge, but got a conflict in xcodeproj/project.pbxproj 更新到 xcode 后,我无法运行我的 flutter 项目 14...一直说无法读取项目“Runner.xcodeproj” - I cant run my flutter project after updating to xcode 14... keep saying Unable to read project 'Runner.xcodeproj' 格式化project.pbxproj - Format project.pbxproj 在项目`Runner.xcodeproj`中找不到名为`Runner`的目标确实找到了`dev`和`prod` - Unable to find a target named `Runner` in project `Runner.xcodeproj` did find `dev` and `prod` Xcode Project错误:无法打开xcodeproj,因为它缺少project.pbxproj文件 - Xcode Project error: xcodeproj cannot be opened because it is missing its project.pbxproj file 项目 ...xcodeproj 无法打开,因为它缺少其 project.pbxproj 文件 - Project ...xcodeproj cannot be opened because it is missing its project.pbxproj file Xcode 7:-F /的链接器警告 <path> 但app.xcodeproj / project.pbxproj中没有设置匹配 <path> - Xcode 7: Linker warning for -F/<path> but no settings in app.xcodeproj/project.pbxproj match <path> 缺少project.pbxproj文件 - Missing project.pbxproj file 在 Xcode 4.2 中提交 project.pbxproj - Commit project.pbxproj in Xcode 4.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM