Flutter iOS build on the App Center fails with error: "Invalid Podfile file: Generated.xcconfig must exist
Flutter iOS build on the App Center fails with error: "Invalid Podfile file: Generated.xcconfig must exist
我刚刚按照 article here.
将我的应用程序设置为在 App Center 上构建
尽管 Android 版本在 App Center 上构建和部署良好,但我在 iOS 构建时遇到错误,如下构建输出的摘录所示:
==============================================================================
Task : CocoaPods
Description : Install CocoaPods dependencies for Swift and Objective-C Cocoa projects
Version : 0.151.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
==============================================================================
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.9.1
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod install --repo-update
[!] Invalid `Podfile` file: Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first.
# from /Users/runner/runners/2.165.2/work/1/s/bdstories/ios/Podfile:51
# -------------------------------------------
# unless File.exist?(generated_xcode_build_settings_path)
> raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
# end
# -------------------------------------------
##[error]The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[section]Finishing: Pod install
##[section]Starting: Xcode build (signed)
我的构建脚本是:
#!/usr/bin/env bash
# Place this script in project/ios/.
# Fail if any command fails.
set -e
# Debug log.
set -x
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel beta
flutter doctor
echo "Installed flutter to `pwd`/flutter"
# Build the app.
flutter build ios --release --no-codesign
我确实添加了错误中提到的 flutter pub get
,但这并没有什么不同。还值得注意的是,当我在本地 Xcode 中构建时,构建工作正常。我也可以毫无问题地将构建的存档部署到 Testflight。这只是我遇到问题的 App Center 构建过程。
我现在有点迷茫,我找不到任何关于如何解决这个问题的信息。我也是 CI/CD 的新手,非常感谢您的帮助!
更新
我还尝试将以下内容添加到脚本中以强制 App Center 运行 使用与我的本地机器相同版本的 Cocoapods,但这对错误没有影响。
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.9.1
pod setup
尝试进入 IOS 文件夹,然后 pod install
或者
pod update
在终端
检查你的.gitIgnore。由于文件被排除在回购之外,出现了同样的问题。
添加回来后一切正常。
还要注意在项目中为 Flutter 定义的路径。
它现在似乎可以工作了。我认为 App Center 构建过程已经更新。
为了您的信息,我在下面包含了我最终的 post-build 脚本,以防它有用:
#!/usr/bin/env bash
#Place this script in project/ios/
# fail if any command fails
set -e
# debug log
set -x
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel beta
flutter doctor
echo "Installed flutter to `pwd`/flutter"
flutter build ios --release --no-codesign
我对我的 post-clone 脚本执行了此操作并且成功了:
#!/usr/bin/env bash
#Place this script in project/ios/
echo "Uninstalling all CocoaPods versions"
sudo gem uninstall cocoapods --all --executables
COCOAPODS_VER=`sed -n -e 's/^COCOAPODS: \([0-9.]*\)//p' Podfile.lock`
echo "Installing CocoaPods version $COCOAPODS_VER"
sudo gem install cocoapods -v $COCOAPODS_VER
# fail if any command fails
set -e
# debug log
set -x
pod setup
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel master
flutter doctor
flutter pub get
echo "Installed flutter to `pwd`/flutter"
flutter build ios --release --no-codesign
技巧似乎是将“如果任何命令失败则失败”部分移至 pod 重新安装之后
我遇到了同样的问题。它发生在 appcenter-post-clone.sh 无法 运行 时,因此未安装 flutter 并且命令 flutter build ios
不会 运行 生成 Generated.xcconfig
.
要修复它,我只是:
- 删除了
appcenter-post-clone
并推送了此提交
- 在构建部分打开了分支的配置。现在 post-clone 标签不见了。保存它。
- 再次使用 appcenter-post-clone.sh 推送另一个提交。
- 再次配置分支,现在返回 post-clone 标签。
- 保存并构建。
1- 导航到 flutter 模块目录
2- 做一个 flutter pub get
** 还要确保你在稳定频道“Flutter”
我刚刚按照 article here.
将我的应用程序设置为在 App Center 上构建尽管 Android 版本在 App Center 上构建和部署良好,但我在 iOS 构建时遇到错误,如下构建输出的摘录所示:
==============================================================================
Task : CocoaPods
Description : Install CocoaPods dependencies for Swift and Objective-C Cocoa projects
Version : 0.151.1
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/cocoapods
==============================================================================
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod --version
1.9.1
[command]/usr/local/lib/ruby/gems/2.6.0/bin/pod install --repo-update
[!] Invalid `Podfile` file: Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first.
# from /Users/runner/runners/2.165.2/work/1/s/bdstories/ios/Podfile:51
# -------------------------------------------
# unless File.exist?(generated_xcode_build_settings_path)
> raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
# end
# -------------------------------------------
##[error]The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[error]The 'pod' command failed with error: The process '/usr/local/lib/ruby/gems/2.6.0/bin/pod' failed with exit code 1
##[section]Finishing: Pod install
##[section]Starting: Xcode build (signed)
我的构建脚本是:
#!/usr/bin/env bash
# Place this script in project/ios/.
# Fail if any command fails.
set -e
# Debug log.
set -x
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel beta
flutter doctor
echo "Installed flutter to `pwd`/flutter"
# Build the app.
flutter build ios --release --no-codesign
我确实添加了错误中提到的 flutter pub get
,但这并没有什么不同。还值得注意的是,当我在本地 Xcode 中构建时,构建工作正常。我也可以毫无问题地将构建的存档部署到 Testflight。这只是我遇到问题的 App Center 构建过程。
我现在有点迷茫,我找不到任何关于如何解决这个问题的信息。我也是 CI/CD 的新手,非常感谢您的帮助!
更新
我还尝试将以下内容添加到脚本中以强制 App Center 运行 使用与我的本地机器相同版本的 Cocoapods,但这对错误没有影响。
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.9.1
pod setup
尝试进入 IOS 文件夹,然后 pod install
或者
pod update
在终端
检查你的.gitIgnore。由于文件被排除在回购之外,出现了同样的问题。
添加回来后一切正常。
还要注意在项目中为 Flutter 定义的路径。
它现在似乎可以工作了。我认为 App Center 构建过程已经更新。 为了您的信息,我在下面包含了我最终的 post-build 脚本,以防它有用:
#!/usr/bin/env bash
#Place this script in project/ios/
# fail if any command fails
set -e
# debug log
set -x
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel beta
flutter doctor
echo "Installed flutter to `pwd`/flutter"
flutter build ios --release --no-codesign
我对我的 post-clone 脚本执行了此操作并且成功了:
#!/usr/bin/env bash
#Place this script in project/ios/
echo "Uninstalling all CocoaPods versions"
sudo gem uninstall cocoapods --all --executables
COCOAPODS_VER=`sed -n -e 's/^COCOAPODS: \([0-9.]*\)//p' Podfile.lock`
echo "Installing CocoaPods version $COCOAPODS_VER"
sudo gem install cocoapods -v $COCOAPODS_VER
# fail if any command fails
set -e
# debug log
set -x
pod setup
cd ..
git clone -b beta https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter channel master
flutter doctor
flutter pub get
echo "Installed flutter to `pwd`/flutter"
flutter build ios --release --no-codesign
技巧似乎是将“如果任何命令失败则失败”部分移至 pod 重新安装之后
我遇到了同样的问题。它发生在 appcenter-post-clone.sh 无法 运行 时,因此未安装 flutter 并且命令 flutter build ios
不会 运行 生成 Generated.xcconfig
.
要修复它,我只是:
- 删除了
appcenter-post-clone
并推送了此提交 - 在构建部分打开了分支的配置。现在 post-clone 标签不见了。保存它。
- 再次使用 appcenter-post-clone.sh 推送另一个提交。
- 再次配置分支,现在返回 post-clone 标签。
- 保存并构建。
1- 导航到 flutter 模块目录 2- 做一个 flutter pub get ** 还要确保你在稳定频道“Flutter”