🕌

Unable to read file at path **/ios/firebase_app_id_file.jsonのエラー

2025/03/01に公開

事象

とあるFlutterのモバイル開発案件で、packageの更新を進めている際にGithub ActionsのCDが失敗するようになった。ログには下記のようなメッセージが出力されていた。

/Users/runner/work/XXX/XXX/ios/Pods/MLKitBarcodeScanning/Frameworks/MLKitBarcodeScanning.framework/MLKitBarcodeScanning', assuming: iOS
error: Unable to read file at path /Users/runner/work/XXX/XXX/ios/firebase_app_id_file.json
Command PhaseScriptExecution failed with a nonzero exit code
note: Run script build phase 'Run Script' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
note: Run script build phase 'Thin Binary' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'Runner' from project 'Runner')
warning: Run script build phase '[firebase_crashlytics] Crashlytics Upload Symbols' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'FlutterFire: "flutterfire upload-crashlytics-symbols"' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

解決策

flutterfireのバージョンを0.2.7から1.1.0にアップグレードしたことに起因。firebase configureでは過去firebase_app_id_file.jsonが生成されていたが、現在はfirebase.jsonが作られるようになったらしい。

ios/Runner.xcodeproj/project.pbxprojのfirebase crashlyticsについて書かれているコードを最新のものに置き換えることで解決。

自分の場合は、以下の手順で対応。

  1. flutterのサンプルプロジェクトを適当に作成
  2. firebase_crashlyticsとfirebase_coreをpubspec.yamlに追加
  3. version 1.1.0でflutterfire configureコマンドの実行
  4. ios/Runner.xcodeproj/project.pbxprojに下記のコード(抜粋)が生成されると思うので、既存のコードを生成されたコードに置き換え
/* FlutterFire: "flutterfire upload-crashlytics-symbols" */ = {
			isa = PBXShellScriptBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			inputFileListPaths = (
			);
			inputPaths = (
			);
			name = "FlutterFire: \"flutterfire upload-crashlytics-symbols\"";
			outputFileListPaths = (
			);
			outputPaths = (
			);
			runOnlyForDeploymentPostprocessing = 0;
			shellPath = /bin/sh;
			shellScript = 省略;
		};

以上。

Discussion