要点
Androidでfastlane使って配信しようとして上手くいかず、沼にハマったけど、
実際はコマンドによるビルドで失敗していた話。
JDK 8
を使わないとダメだよという話。
(筆者はjdk-8u231-macosx-x64.dmg
をインストールして解決)
経緯
環境構築で、AndroidアプリをfastlaneによってbetaからDLできるような作りになっていた。
fastlane入れる。
fastlaneコマンドを叩く
はい!エラー!
fastlane_error
$ bundle exec fastlane staging
[✔] 🚀
[14:31:08]: ----------------------------------------
[14:31:08]: --- Step: Verifying fastlane version ---
[14:31:08]: ----------------------------------------
[14:31:08]: Your fastlane version 2.137.0 matches the minimum requirement of 1.109.0 ✅
[14:31:08]: The `generated_fastfile_id` action was deprecated, you can remove the line from your `Fastfile`
[14:31:08]: ------------------------------
[14:31:08]: --- Step: default_platform ---
[14:31:08]: ------------------------------
[14:31:08]: Driving the lane 'staging' 🚀
[14:31:08]: --------------------
[14:31:08]: --- Step: gradle ---
[14:31:08]: --------------------
[14:31:08]: $ /Users/anonymous/pjt/project-android/gradlew assemblebetadebug -p .
[14:31:09]: ▸ > Configure project :app
[14:31:09]: ▸ WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
[14:31:09]: ▸ It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
[14:31:09]: ▸ FAILURE: Build failed with an exception.
[14:31:09]: ▸ * What went wrong:
[14:31:09]: ▸ A problem occurred configuring project ':app'.
[14:31:09]: ▸ > SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/anonymous/pjt/project-android/local.properties'.
[14:31:09]: ▸ * Try:
[14:31:09]: ▸ Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[14:31:09]: ▸ * Get more help at https://help.gradle.org
[14:31:09]: ▸ Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
[14:31:09]: ▸ Use '--warning-mode all' to show the individual deprecation warnings.
[14:31:09]: ▸ See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
[14:31:09]: ▸ BUILD FAILED in 0s
+-------------------+---------+
| Lane Context |
+-------------------+---------+
| DEFAULT_PLATFORM | android |
| PLATFORM_NAME | |
| LANE_NAME | staging |
| GRADLE_BUILD_TYPE | debug |
| GRADLE_FLAVOR | beta |
+-------------------+---------+
[14:31:10]: Exit status of command '/Users/anonymous/pjt/project-android/gradlew assemblebetadebug -p .' was 1 instead of 0.
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/anonymous/pjt/project-android/local.properties'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
+------+----------------------------+-------------+
| fastlane summary |
+------+----------------------------+-------------+
| Step | Action | Time (in s) |
+------+----------------------------+-------------+
| 1 | Verifying fastlane version | 0 |
| 2 | default_platform | 0 |
| 💥 | gradle | 1 |
+------+----------------------------+-------------+
[14:31:10]: fastlane finished with errors
Looking for related GitHub issues on fastlane/fastlane...
#######################################################################
# fastlane 2.138.0 is available. You are on 2.137.0.
# You should use the latest version.
# Please update using `bundle update fastlane`.
#######################################################################
2.138.0 Improvements
* [action] fix app_store_build_number so it works with macOS builds. (#15688) via Michael Block
* [supply] support default changelog (#15701) via Janic Duplessis
* [spaceship] add basic support for retrieving TestFlight Feedback screenshots via ConnectAPI (#15793) via Max Ott
* [supply] fix supply error when no tracks are returned (#15799) via Michael Collins
* [spaceship] ignore corrupted cookie file (#15809) via ubamrein
* [action] register_devices: More useful error message for invalid device files (#15801) via Alex Ghiculescu
* [gemspec] ensure excon version is at least 0.71.0 (CVE-2019-16779) (#15812) via Rajiv Shah
* [action] make xcode_select action's details clearer (#15579) via Iulian Onofrei
* [spaceship] fix language list retrieving (#15572) via mugabe
* [match] add bearer authentication support for git (#15722) via Vasco Gonçalves
* [action] get_version_number: Supports when INFOPLIST_FILE is specified as an absolute path (#15738) via Yoon Joonghyun
* [action] fix with new default parameter for increment version (#15737) via Adam
* [action] verify_build: remove extraneous quote (#15758) via Nick Hodapp
* [gemspec] change xcodeproj dependency to be 1.13.0 minimum (#15728) via Hannes Oud
* [action] add the BITRISE_IO env var to the is_ci check. (#15716) via Sebastian Hubrich
* [screenscrab] use AdbHelper instead of duplicated code (#15402) via Jan Piotrowski
Please update using `bundle update fastlane`
bundler: failed to load command: fastlane (/Users/anonymous/.rbenv/versions/2.4.4/bin/fastlane)
FastlaneCore::Interface::FastlaneShellError: [!] Exit status of command '/Users/anonymous/pjt/project-android/gradlew assemblebetadebug -p .' was 1 instead of 0.
> Configure project :app
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/anonymous/pjt/project-android/local.properties'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 0s
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/helper/gradle_helper.rb:32:in `trigger'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/actions/gradle.rb:56:in `run'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:256:in `block (2 levels) in execute_action'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:235:in `block in execute_action'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:227:in `chdir'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
Fastfile:20:in `block in parsing_binding'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/lane.rb:33:in `call'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:45:in `chdir'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/runner.rb:45:in `execute'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/lane_manager.rb:56:in `cruise_lane'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
/Users/anonymous/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/fastlane-2.137.0/bin/fastlane:23:in `<top (required)>'
/Users/anonymous/.rbenv/versions/2.4.4/bin/fastlane:23:in `load'
/Users/anonymous/.rbenv/versions/2.4.4/bin/fastlane:23:in `<top (required)>'
解決
結局**JDK 8
**使わなきゃいけないところ、JDK 13
を使ってることでどハマりしてた。
gradleで死んでるし、そのあたりを検索したり、fastlane使ってるからそこを検索していたけど、fastlane+Androidの情報自体少ないし…怪しい単語で検索しまくって丸1日浪費してた。
そしてもう1度エラー内容見て、fastlane関係なくターミナルからコマンドビルドがそもそもダメじゃない?って思い至って、検索したらJDK 8云々って出てくるので、試したら成功したという話。