3
0

More than 3 years have passed since last update.

【iOS】Fastlaneのincrement_build_numberがビルドナンバーを取れずにエラーになる際の対処法

Last updated at Posted at 2020-09-11

結論から言うと、プロジェクトディレクトリの中に複数のプロジェクトファイルが存在しているとエラーになります。余計なプロジェクトファイルを消せば解決します。

以下は経緯。


プロジェクトのビルドナンバーをインクリメントしたいときに便利なのが、Fastlane Actionのincrement_build_numberですが、なぜか自分の環境だけ、以下の様なエラーが出ました。

-> % bundle exec fastlane run increment_build_number
[✔] 🚀 
[16:22:33]: ------------------------------------
[16:22:33]: --- Step: increment_build_number ---
[16:22:33]: ------------------------------------
There are multiple projects in this directory.  agvtool does not work with multiple projects in the same directory.

agvtool - Apple-generic versioning tool for Xcode projects
  usage:
    agvtool help
    agvtool what-version | vers [-terse]
    agvtool [-noscm | -usecvs | -usesvn] next-version | bump [-all]
    agvtool [-noscm | -usecvs | -usesvn] new-version [-all] <versNum>
    agvtool [-noscm | -usecvs | -usesvn] tag [-force | -F] [-noupdatecheck | -Q] [-baseurlfortag]
    agvtool what-marketing-version | mvers [-terse | -terse1]
    agvtool [-noscm | -usecvs | -usesvn] new-marketing-version <versString>


[!] Apple Generic Versioning is not enabled in this project.
Before being able to increment and read the version number from your Xcode project, you first need to setup your project properly. Please follow the guide at https://developer.apple.com/library/content/qa/qa1827/_index.html

opps... バージョンナンバーが取れてませんね。

よくみると、以下の様なエラー文言が出ています。

There are multiple projects in this directory. agvtool does not work with multiple projects in the same directory.

avgtoolはプロジェクトディレクトリ直下に複数のプロジェクトがある場合動かなくなるとのこと。

というわけで、プロジェクトディレクトリの中に、他に余計なプロジェクトファイルが紛れてないか確認してみましょう。もしあれば削除してみましょう。

早速、削除した後に叩いてみると無事実行されました。

-> % bundle exec fastlane run increment_build_number
[✔] 🚀 
[16:28:00]: ------------------------------------
[16:28:00]: --- Step: increment_build_number ---
[16:28:00]: ------------------------------------
Current version of project *** is: 
    2751

/Users/hoge/iOS/***
[16:28:01]: $ cd /Users/hoge/iOS/*** && agvtool next-version -all && cd -
[16:28:01]: ▸ Setting version of project *** to:
[16:28:01]: ▸ 2752.
[16:28:01]: ▸ Also setting CFBundleVersion key (assuming it exists)
[16:28:01]: ▸ Updating CFBundleVersion in Info.plist(s)...
[16:28:01]: ▸ Updated CFBundleVersion in "***.xcodeproj/../***/SupportingFiles/***-Info.plist" to 2752
[16:28:02]: ▸ Updated CFBundleVersion in "***.xcodeproj/../***1/Info.plist" to 2752
[16:28:02]: ▸ Updated CFBundleVersion in "***.xcodeproj/../***2/Info.plist" to 2752
[16:28:02]: ▸ Updated CFBundleVersion in "***.xcodeproj/../***3/Info.plist" to 2752
[16:28:02]: ▸ /Users/hoge/iOS/***
[16:28:02]: Result: 2752

同じエラーにお悩みの方はぜひ参考に。( @koiwai2020 さん教えてくれてありがとうございます。)

こんな記事もどうぞ

GoogleスプレッドシートとFastlaneでApp Store説明文を自動更新する方法

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