🐙

FlutterでFirebaseの環境毎設定でMultiple commands produce ~が出るようになってしまった場合

2021/08/28に公開

Flutterでdev/stg/prodごとにFirebase用の設定ファイルであるGooleService-Info.plistを生成するコードを弄っていたら下記のようなのエラーが出るようになってしまった。

error: Multiple commands produce '/Users/~/ios/Debug-iphonesimulator/Runner.app/GoogleService-Info.plist':
    1) Target 'Runner' (project 'Runner') has copy command from '/Users/~/ios/Runner/dev/GoogleService-Info.plist' to '/Users/~/build/ios/Debug-iphonesimulator/Runner.app/GoogleService-Info.plist'
    2) Target 'Runner' (project 'Runner') has copy command from '/Users/~/ios/Runner/stg/GoogleService-Info.plist' to '/Users/~/build/ios/Debug-iphonesimulator/Runner.app/GoogleService-Info.plist'

どうもGooleService-Info.plistを削除したり入れ替えたりしてるうちにファイルが重複してしまったようだ。

解決方法としては、Runner > TARGETS(Runner) > Build PhasesCopy Bundle Resources に登録してあるGoogleService-Info.plistを全て削除すれば良い。

その後またビルドすれば元通りになる。

Discussion