LoginSignup
0
0

More than 1 year has passed since last update.

fastlaneで `sh("flutter build ipa ...")` やったときにぶち当たった error: exportArchive: The data couldn’t be read because it isn’t in the correct format のエラーを直せたやり方

Last updated at Posted at 2022-05-29

事象

fastlaneでFlutterのビルドをするときに以下のようなコマンドを実行した

Fastfile
sh("flutter build ipa --release --flavor #{flavor} --dart-define=FLAVOR=#{flavor} --export-method #{method}")

※変数部分の内容は割愛

すると、

2019-07-10 10:53:31.367 xcodebuild[71361:4395732] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/rc/_dsryxmx5tz2l7h9rc9xqqc80000gn/T/Fastlane - Dev_2019-07-10_10-53-31.367.xcdistributionlogs'.
error: exportArchive: The data couldn’t be read because it isn’t in the correct forma

でipaファイルを作成できなかった。

環境

$ flutter --version
Flutter 3.0.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ee4e09cce0 (3 weeks ago) • 2022-05-09 16:45:18 -0700
Engine • revision d1b9a6938a
Tools • Dart 2.17.0 • DevTools 2.12.2

$ bundle --version
Bundler version 2.3.14

$ bundle exec fastlane -v
fastlane installation at path:
path/to/project/vendor/bundle/ruby/3.0.0/gems/fastlane-2.206.2/bin/fastlane
-----------------------------
[✔] 🚀
fastlane 2.206.2

調べたこと

同じ事象があった。

内心助かったー、と思ったら

Well, after all the struggles we had, I ended up formatting, and this fixed my problem, I don't know what environment bug I had, but this worked...
Thanks.
ざっくり訳

「Macをフォーマット(初期化)したら治った!!!」

なん...だと...

さすがにこれだけのために初期化は辛いので、色々調査

気づいたこと

「...あれ、ExportOptions.plistが生成されていないな」

通常 flutter build ipa でipa作成時、ipa出力するディレクトリに ExportOptions.plist が生成される(xcodeが作成したものを複製している)

だが、生成されていない

やったこと

なんとなく権限周りなのかなーと思い、以下のコマンドに変更

Fastfile
sh("sudo -u `whoami` flutter build ipa --release --flavor #{flavor} --dart-define=FLAVOR=#{flavor} --export-method #{method}")

動いた!!!

原因

わからない。だれか教えて下さい!!

0
0
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
0
0