fastlane: AGV enabled check fails

New Issue Checklist

Issue Description

Since https://github.com/fastlane/fastlane/pull/9474 is in 2.39.1, I get the following warning:

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

My app has Apple Generic Versioning enabled.

screen shot 2017-06-16 at 11 49 41 am

Complete output when running fastlane, including the stack trace and command used

You can use: --capture_output as the last commandline argument to get that collected for you

bundle exec fastlane propagate-version && git add ios/ android/

+-------------------------+---------+---------------------------+
|                         Used plugins                          |
+-------------------------+---------+---------------------------+
| Plugin                  | Version | Action                    |
+-------------------------+---------+---------------------------+
| fastlane-plugin-bugsnag | 1.1.0   | upload_symbols_to_bugsnag |
+-------------------------+---------+---------------------------+

[11:47:46]: You require a gem, if this is a third party gem, please use `fastlane_require 'fileutils'` to ensure the gem is installed locally
[11:47:46]: -------------------------------------------------
[11:47:46]: --- Step: Verifying required fastlane version ---
[11:47:46]: -------------------------------------------------
[11:47:46]: Your fastlane version 2.39.1 matches the minimum requirement of 2.19.0  โœ…
[11:47:46]: Driving the lane 'propagate-version' ๐Ÿš€
[11:47:46]: FL_HOCKEY_COMMIT_SHA is
[11:47:46]: GYM_PROJECT is ./ios/AllAboutOlaf.xcodeproj
[11:47:46]: GYM_SCHEME is AllAboutOlaf
[11:47:46]: GYM_OUTPUT_DIRECTORY is ./ios/build
[11:47:46]: GYM_OUTPUT_NAME is AllAboutOlaf
[11:47:46]: FL_GRADLE_PROJECT_DIR is ./android
[11:47:46]: PRETTY_APP_NAME is All About Olaf
[11:47:46]: GRADLE_FILE is ./android/app/build.gradle
[11:47:46]: PLATFORM_NAME is
[11:47:46]: -----------------------------
[11:47:46]: --- Step: get_package_key ---
[11:47:46]: -----------------------------
[11:47:46]: Propagating version: 2.4.0-beta.7
[11:47:46]: into the Info.plist and build.gradle files
[11:47:46]: --------------------------------------
[11:47:46]: --- Step: increment_version_number ---
[11:47:46]: --------------------------------------
[11:47:46]: $ cd /Users/rives/Projects/aao/ios && agvtool new-marketing-version 2.4.0
[11:47:46]: โ–ธ Setting CFBundleShortVersionString of project AllAboutOlaf to:
[11:47:46]: โ–ธ 2.4.0.
[11:47:46]: โ–ธ Updating CFBundleShortVersionString in Info.plist(s)...
[11:47:47]: โ–ธ Updated CFBundleShortVersionString in "AllAboutOlaf.xcodeproj/../AllAboutOlaf/Info.plist" to 2.4.0
[11:47:47]: โ–ธ Updated CFBundleShortVersionString in "AllAboutOlaf.xcodeproj/../AllAboutOlafUITests/Info.plist" to 2.4.0
[11:47:47]: ------------------------------------
[11:47:47]: --- Step: increment_build_number ---
[11:47:47]: ------------------------------------
There are no Xcode project files in this directory.  agvtool needs a project to operate.
+-----------------+----------------------------+
|                 Lane Context                 |
+-----------------+----------------------------+
| PLATFORM_NAME   |                            |
| LANE_NAME       | propagate-version          |
| PRETTY_APP_NAME | All About Olaf             |
| GRADLE_FILE     | ./android/app/build.gradle |
| VERSION_NUMBER  | 2.4.0                      |
+-----------------+----------------------------+
[11:47:47]: 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

+------+------------------------------+-------------+
|                 fastlane summary                  |
+------+------------------------------+-------------+
| Step | Action                       | Time (in s) |
+------+------------------------------+-------------+
| 1    | Verifying required fastlane  | 0           |
|      | version                      |             |
| 2    | get_package_key              | 0           |
| 3    | increment_version_number     | 0           |
| ๐Ÿ’ฅ   | increment_build_number       | 0           |
+------+------------------------------+-------------+

[11:47:47]: fastlane finished with errors

[!] 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

Environment

Please run fastlane env and copy the output below. This will help us help you ๐Ÿ‘ If you used --capture_output option please remove this block - as it is already included there.

Captured Output

Command Used: env

Output/Log

INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/latest_hockeyapp_version_number.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/get_gradle_version_name.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/activate_rogue_team.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/set_gradle_version_name.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/latest_hockeyapp_notes.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/get_package_key.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/set_gradle_version_code.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/set_package_data.rb'.
INFO [2017-06-16 11:48:25.95]: Successfully loaded custom action '/Users/rives/Projects/aao/fastlane/actions/get_gradle_version_code.rb'.
WARN [2017-06-16 11:48:25.96]: Generating fastlane environment output, this might take a few seconds...
DEBUG [2017-06-16 11:48:26.26]: Checking if there are any plugins that should be loaded...
DEBUG [2017-06-16 11:48:26.26]: Loading 'fastlane-plugin-bugsnag' plugin
INFO [2017-06-16 11:48:26.31]: gem 'fastlane-plugin-bugsnag' is already installed

Looking for related GitHub issues on fastlane/fastlane...
Search query: undefined method `length' for nil

URL: https://api.github.com/search/issues?q=undefined%20method%20%60length'%20for%20nil+repo:fastlane/fastlane
โžก๏ธ  fastlane pilot find: undefined method `length' for nil:NilClass
    https://github.com/fastlane/fastlane/issues/8885 [closed] 1 ๐Ÿ’ฌ
    14 Apr 2017

โžก๏ธ  undefined method `install_gem' for #<Gem::Commands::InstallCommand
    https://github.com/fastlane/fastlane/issues/8489 [closed] 2 ๐Ÿ’ฌ
    a week ago

โžก๏ธ  `supported_platforms': [!] undefined method `split' for nil:NilClass (NoMethodError)
    https://github.com/fastlane/fastlane/issues/7141 [closed] 43 ๐Ÿ’ฌ
    07 Mar 2017

and 13 more at: https://github.com/fastlane/fastlane/search?q=undefined%20method%20%60length'%20for%20nil&type=Issues&utf8=โœ“

๐Ÿ”—  You can โŒ˜ + double-click on links to open them directly in your browser.


โœ… fastlane environment โœ…

Stack

Key Value
OS 10.13
Ruby 2.4.1
Bundler? true
Git git version 2.13.1
Installation Source /usr/local/bin/fastlane
Host Mac OS X 10.13 (17A264c)
Ruby Lib Dir /usr/local/Cellar/ruby/2.4.1_1/lib
OpenSSL Version OpenSSL 1.0.2k 26 Jan 2017
Is contained false
Is homebrew false
Is installed via Fabric.app false
Xcode Path /Applications/Xcode-beta.app/Contents/Developer/
Xcode Version 9.0

System Locale

Variable Value
LANG en_US.UTF-8 โœ…
LC_ALL
LANGUAGE

fastlane files:

`./fastlane/Fastfile`
# All fastlane files are Ruby files.

# Customise this file! Documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs

# Set a minimum version for fastlane
fastlane_version '2.19.0'

require 'fileutils'

import 'lib/before_all.rb'
import 'lib/util.rb'

import 'platforms/agnostic.rb'
import 'platforms/android.rb'
import 'platforms/ios.rb'
`./fastlane/Appfile`
# The bundle identifier of your app
app_identifier 'NFMTHAZVS9.com.drewvolz.stolaf'

# Your Apple email address
apple_id 'sgawebmaster@stolaf.edu'

# This is a private key. It is not included in the repository.
# Contact odt@stolaf.edu or another admin if you need access.
json_key_file 'fastlane/play-private-key.json'
package_name 'com.allaboutolaf'

fastlane gems

Gem Version Update-Status
fastlane 2.39.1 โœ… Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-bugsnag 1.1.0 โœ… Up-To-Date
Loaded gems
Gem Version
did_you_mean 1.1.0
bundler 1.14.6
io-console 0.4.6
rake 12.0.0
CFPropertyList 2.3.5
concurrent-ruby 1.0.5
i18n 0.8.4
minitest 5.10.2
thread_safe 0.3.6
tzinfo 1.2.3
activesupport 5.1.1
activemodel 5.1.1
public_suffix 2.0.5
addressable 2.5.1
awesome_print 1.7.0
babosa 1.0.2
curb 0.9.3
fastimage 2.1.0
colored 1.2
highline 1.7.8
commander-fastlane 4.4.4
dotenv 2.2.1
excon 0.57.0
multipart-post 2.0.0
faraday 0.12.1
unf_ext 0.0.7.4
unf 0.1.4
domain_name 0.5.20170404
http-cookie 1.0.3
faraday-cookie_jar 0.0.6
faraday_middleware 0.11.0.1
gh_inspector 1.0.3
jwt 1.5.6
little-plugger 1.1.4
multi_json 1.12.1
logging 2.2.2
memoist 0.15.0
os 0.9.6
signet 0.7.3
googleauth 0.5.1
httpclient 2.8.3
mime-types-data 3.2016.0521
mime-types 3.1
declarative 0.0.9
declarative-option 0.1.0
uber 0.1.0
representable 3.0.4
retriable 3.0.2
google-api-client 0.12.0
json 2.1.0
mini_magick 4.5.1
multi_xml 0.6.0
plist 3.3.0
rubyzip 1.2.1
security 0.1.3
slack-notifier 1.5.1
terminal-notifier 1.8.0
unicode-display_width 1.2.1
terminal-table 1.8.0
tty-screen 0.5.0
word_wrap 1.0.0
claide 1.0.2
colored2 3.1.2
nanaimo 0.2.3
xcodeproj 1.5.0
rouge 2.0.7
xcpretty 0.2.8
xcpretty-travis-formatter 0.0.4
badge 0.8.4
diff-lcs 1.3
docile 1.1.5
fastlane-plugin-bugsnag 1.1.0
httparty 0.15.5
mimemagic 0.3.2
httmultiparty 0.3.16
rspec-support 3.6.0
rspec-core 3.6.0
rspec-expectations 3.6.0
rspec-mocks 3.6.0
rspec 3.6.0
simplecov-html 0.10.1
simplecov 0.14.1
hockeyapp 0.0.15

generated on: 2017-06-16

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 33 (28 by maintainers)

Most upvoted comments

For others, I got it working by cleaning out the install and going down a version.

$ gem uninstall fastlane
$ rm -rf $HOME/.fastlane

.. remove "$HOME/.fastlane" from $PATH ..

$ rm /Users/aj/.rbenv/shims/fastlane
$ gem install fastlane -v 2.39.0

Hey @ohayon, thanks for your help!

Output of agvtool what-version was:

There does not seem to be a CURRENT_PROJECT_VERSION key set for this project.  Add this key to your target's expert build settings.

This was the issue, once I set the key CURRENT_PROJECT_VERSION it started to work. We have never used CURRENT_PROJECT_VERSION key before. Our version string and build number are set via projectโ€™s plist. I will ask the fellow developer whether it is an issue for his local builds if we set this field.

Maybe we have to improve more things in order to get supported/recommended scenario. Please may you help me understand what is the added value of the implemented stricter check and why this scenario is no longer recommended and supported?

Why is this closed? i have same issue when my project is in a subfolder

meanwhile, downgrading

sudo gem uninstall fastlane -v 2.39.1
sudo gem install fastlane -v 2.39.0

@mpirri Iโ€™m still getting the same issue on 2.39.2 unfortunately. 2.39.0 works fine for me. Thanks for the hard work!

@ohayon Thanks a lot for your explanation and help. This is my first exposure to the agvtool. So far I thought that the increment_build_number is a nice wrapper around action set_info_plist_value, specifically for version related stuff. I cannot find a source code for agvtool, what is a common issue with most Apple tooling. You wrote:

We want to make sure that people who are using the increment_build_number action are using AGV so that all behavior is expected.

Please could you help me to understand the benefits of using agvtool in the increment_build_number action over directly modifying plist files?

Hey @GoodMirek, yeah 2.39.0 works fine because it doesnโ€™t check for AGV before setting the build number. Using increment_build_number will only work if you have AGV enabled. Is your xcodeproj file in a nested directory? Could you try passing and xcodeproj: 'path/to/xcodeproj' argument to the increment_build_number action to see if that would work?

Also, could you verify that AGV is setup properly by running agvtool what-version in the same directory as your project?

Hey @juliensaad - no problem! I hope you get back to a working place as soon as you can! Just to be clear the increment_build_number action used to not care about whether or not AGV was enabled, but now it does because it seemed like the fact that it used to work was not intended behavior as agvtool would return a non-zero exit code which can cause for some confusion. For that reason I changed it to throw an exception if AGV is not enabled. If you need to set the build number, you can use the set_info_plist_value instead.

It breaks if the xcodeproj isnโ€™t in the root directory. For example, any react native project.

https://github.com/fastlane/fastlane/commit/d896e9715fb44825621ba70fe1da5ab936fa3d4a

It needs check the :xcodeproj folder parameter to change directory, or it fails.

There are no Xcode project files in this directory.  agvtool needs a project to operate.

@janpio You can set CURRENT_PROJECT_VERSION in your project file (probably project.pbxproj) with action update_xcodeproj, available from plugin of the same name.

Other option could be to set build number directly in your plist file with action set_info_plist_value, then you do not need action increment_build_number. The name of the key in the plist file is CFBundleVersion. More details about build number and plist file are available from the link in my earlier post.

What is better depends whether you want to set the build number directly or you want to increment existing value instead or you have another reason for enabling agvtool.

Hi @ohayon. I have had the same configuration for my project as @GoodMirek wrote. After enabling AGV it seem to work again.

Hey @GoodMirek, yeah the value of having this stricter check is that even though in your case, the build number was getting set, agvtool was returning a non-zero exit code, so this could cause some unintended behavior. We want to make sure that people who are using the increment_build_number action are using AGV so that all behavior is expected.

If for whatever reason, you are unable to set that field, you can use the set_info_plist_value action to set the value of the plist key that you are already using for your build number. Does that make sense? ๐Ÿ˜„

When is the next release going to be available to fix this without downgrading? ๐Ÿ˜ƒ

Kind Regards!

NM, just read they usually ship once a week ๐Ÿ˜ƒ

Thanks for the fix when it comes hawkrives!