開発環境
OS: MacOS
Flutter: 3.0.4
Flutter Channel: Stable
Dart: 2.17.5
Android Studio: Artic Fox | 2020.3.1 Patch4
エラーメッセージ
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXX
Running pod install...
Running Xcode build...
Xcode build done. 8.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/xz/8ytcyfm94hj21ggqskb0fgsc0000gn/T/flutter_tools.XxfdYA/flutter_ios_build_temp_dirhG8RAE/temporary_xcresult_bundle
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
/Users/ユーザ名/AndroidStudioProjects/アプリ名/ios/Flutter/Release.xcconfig:3:1: error: could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
/Users/ユーザ名/AndroidStudioProjects/アプリ名/ios/Flutter/Release.xcconfig:3:1: error: could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
/Users/ユーザ名/AndroidStudioProjects/アプリ名/ios/Flutter/Release.xcconfig:3:1: error: could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
Result bundle written to path:
/var/folders/xz/8ytcyfm94hj21ggqskb0fgsc0000gn/T/flutter_tools.XxfdYA/flutter_ios_build_temp_dirhG8RAE/temporary_xcresult_bundle
Could not build the precompiled application for the device.
Error (Xcode): could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
/Users/ユーザ名/AndroidStudioProjects/アプリ名/ios/Flutter/Release.xcconfig:2:0
Error running application on 実機名.
原因
includeに指定したファイルのパスが誤っていることが原因です。
下記エラーメッセージではRelease.xcconfigにてincludeに指定しているPods-Runner.profile.xcconfigが見つからないよ、と言っています。
Error (Xcode): could not find included file 'Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig' in search paths
/Users/ユーザ名/AndroidStudioProjects/アプリ名/ios/Flutter/Release.xcconfig:2:0
実際にファイルの階層を確認してみると頭のPods/が抜けていることがわかります。
※ Release.xcconfigから見た相対パス
対処法
ios/Flutter/Release.xcconfigにてincludeに指定しているファイルのパスを修正します。
Pods-Runner.profile.xcconfigの先頭にPods/を追加します。
修正前
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
// ↓修正対象
#include "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
修正後
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
// ↓先頭にPods/を追加
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"