LoginSignup
6
4

More than 1 year has passed since last update.

flutter_flavorizr + flutter_flavorでFlutterの環境切り替えした後に、iOSでbuildした時の 「Unable to load contents of file list」の解決方法

Last updated at Posted at 2021-08-27

概要

Flutterの開発環境/本番環境を「flutter_flavorizr + flutter_flavor」を使って、切り替えできるように対応しました。
下記の問題が発生しました。 こちらの記事のその解決を記載しています。

  • iOSでbuildすると、「Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-development-input-files.xcfilelist'」のErrorが出て、buildが通らない

対応環境

(Errorが出ている。。。あとで直そう)

[✓] Flutter (Channel master, 2.5.0-7.0.pre.15, on macOS 11.3.1 20E241 darwin-x64,
    locale ja-JP)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more
      details.
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.59.1)
[✓] Connected device (2 available)

前提処理

下記の2つを記事を見ながら進めました。
Flutter で環境を分ける方法
flutter_flavor + flutter_flavorizr を使って Flutter の Flavor を設定する

iOSでbuildする段階で問題発生

iOSでbuildすると、「Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-development-input-files.xcfilelist'」のErrorが出て、buildが通らない

こちらの対策として、下記の3つの手順を行いました。

  1. podfileの更新
  2. Xcode上でのConfigurationsの設定
  3. XcodeのFlutterフォルダの、「Debug-(環境名)」等の中身を修正する

1. podfileの更新

作成した環境に合わせて、Configurations先を追加しました。

Before

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

After

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
  'Debug-development' => :debug,
  'Profile-development' => :release,
  'Release-development' => :release,
  'Debug-production' => :debug,
  'Profile-production' => :release,
  'Release-production' => :release,
}

2. Xcode上でのConfigurationsの設定

作成した環境に合わせてConfigurationsが増えるいるので、適切なものが入るようにします。
Runner_xcodeproj.png

3. XcodeのFlutterフォルダの、「Debug-(環境名)」等の中身を修正する

XcodeのFlutterフォルダとは、赤枠の範囲を指します。
Runner_xcodeproj2.png

今回は、「Unable to load contents of file list: '/Target Support Files/Pods-Runner/Pods-Runner-frameworks-Debug-development-input-files.xcfilelist'」というError解消のため、 developmentDebug.xcconfigを編集します。

先頭に一行下記を加えるだけです!(環境ごとに書く内容は切り替えてください。)

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-development.xcconfig"

Before

#include "Generated.xcconfig"

FLUTTER_TARGET=lib/main-development.dart

ASSET_PREFIX=development
BUNDLE_NAME= BUNDLE_NAME

After

#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-development.xcconfig"
#include "Generated.xcconfig"

FLUTTER_TARGET=lib/main-development.dart

ASSET_PREFIX=development
BUNDLE_NAME= BUNDLE_NAME

備考

こちらでXcodeからのbuildが通るようになると思います!
まだAndroid Studioから直接実行できていないので、そちらの解決方法が分かりしたい追記したいと思います。
最後まで読んでいただき、ありがとうございました。

【追記】

Android Studio Error対応

Create Bridging Header調整
https://qiita.com/emaame/items/f625464f3eb38f7850ab

arm64追記(これはいらなかった。これがあることで、実機buildができなかった。。。。)
http://blog.be-style.jpn.com/article/187942746.html

【追記2】
i386のみでよかった!
スクリーンショット_2021_08_29_23_58.png

6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4