LoginSignup
2
6

More than 3 years have passed since last update.

[Dart/Flutter] エラー対応記事 (継続追記用)

Last updated at Posted at 2019-11-10

概要

Flutterのエラー対応に関しての記事をどんどん追記記載していく

経緯

Flutterを運用していく時に、数々のエラーが発生します。
その度にググって対応してきたのですが、少しでもまとまっていた便利かなと思いまとめました。
基本的なエラーもあれば、普通は起きないものもあるとは思いますが、とりあえずはどんどん記載して、ある程度溜まってきた段階で依存する問題のカテゴライズもできたらと思います。

エラー一覧

Flutter run した時に起きたエラー

1. FileSystemException: FileSystemException: Getting current working directory failed, path = '' (OS Error: Too many open files, errno = 24)

$ flutter run
Launching lib/main.dart on iPhone Xs in debug mode...

Oops; flutter has exited unexpectedly.
Sending crash report to Google.
Crash report sent (report ID: 2f1faa90781c3c03)
flutter_01.log

Flutter crash report; please file at https://github.com/flutter/flutter/issues.

## command

flutter run

## exception

FileSystemException: FileSystemException: Getting current working directory failed, path = '' (OS Error: Too many open files, errno = 24)

・・・

解決方法

$ ulimit -S -n 2048 で解決

$ ulimit -S -n 2048
$ flutter run 
Launching lib/main.dart on iPhone Xs in debug mode...
Running Xcode build...                                                  

 ├─Assembling Flutter resources...                           2.6s
 └─Compiling, linking and signing...                         6.6s
Xcode build done.                                           11.5s

・・・

参考

2. Framework File Duplicate

発生タイミング

$ flutter build ios --release
を実行してbuild fileを生成した後に
$ flutter run
を実行すると吐く

    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    2019-11-10 17:17:12.208 defaults[55665:38131764] 
    The domain/default pair of
    (/Users/SampleApp/build/ios/Debug-iphonesimulator/Runner.app/F
    rameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/Info.plist,
    CFBundleExecutable) does not exist
    fatal error: lipo: can't map input file:
    /Users/SampleApp/build/ios/Debug-iphonesimulator/Runner.app/Fr
    ameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
    fatal error: lipo: can't map input file:
    /Users/SampleApp/build/ios/Debug-iphonesimulator/Runner.app/Fr
    ameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)
    Failed to extract x86_64 for
    /Users/SampleApp/build/ios/Debug-iphonesimulator/Runner.app/Fr
    ameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/. Running lipo -info:
    fatal error: lipo: can't map input file:
    /Users/SampleApp/build/ios/Debug-iphonesimulator/Runner.app/Fr
    ameworks/App.framework/flutter_assets/ios/Flutter/App%202.framework/ (Invalid argument)

解決策

ios/Flutter 配下の App 2.framework および Flutter 2.framework などと重複して生成されているファイルを削除する。

※ 時々、ios/Pods配下のフォルダー内でも重複が発生したり、ios/Podfile.lockが複製されたりするので、この際は、
$ rm -rf ios/Pods
$ rm -rf ios/Podfile.lock
実行するなどして削除後、
$ cd ios でios配下に移動し、
$ pod install
を実行すると正常化される現象も確認されています。

3. The application's Info.plist does not contain CFBundleVersion.

発生タイミング

$ flutter run した際に発生
以下のエラーメッセージが表示される

Sending crash report to Google.
Crash report sent (report ID: 7653dd7440c7c434)
Oops; flutter has exited unexpectedly.
Crash report written to /Users/ryoichikataoka/Desktop/Shakey-flutter/shakey/flutter_03.log;
please let us know at https://github.com/flutter/flutter/issues.

Error logが作成されているようなのでこちらを見てみる。

flutter.logを見るとこんな感じで記載されている

flutter_01.log
ProcessException: ProcessException: Process "/usr/bin/xcrun" exited abnormally:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The application's Info.plist does not contain CFBundleVersion.
Ensure your bundle contains a CFBundleVersion.

解決策-1

  1. Simulator の menu barに行く
  2. Hardwareを選択
  3. Erase All Content and SettingでHardwareの初期化を実行

解決策-2

ios/Runner/info.plist に追記する。

info.plist

・・・
<dict>
    <key>CFBundleVersion</key>
    <string>$(FLUTTER_BUILD_NUMBER)</string>
・・・
</dict>

参考

2
6
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
2
6