fastlane: upload_to_play_store Google Api Error: forbidden: APK is not a valid ZIP archive
New Issue Checklist
- Updated fastlane to the latest version
- I read the Contribution Guidelines
- I read docs.fastlane.tools
- I searched for existing GitHub issues
Issue Description
Today our CI(Circle)/Fastlane process failed to upload the APK to the Google Play Store with the following error in upload_to_play_store:
[18:06:45]: Google Api Error: forbidden: APK is not a valid ZIP archive - APK is not a valid ZIP archive
Our CI system performs daily updates of our app since over a year. There has been no change to the codebase since the last successful update (24h earlier), suggesting some Google API Change or an issue introduced on July 1st. Googling for the error actually brings up 0 results and I would be looking for other people that are affected by the same error
Also, the artifact produced is a valid ZIP file:
circleci@2d6fd17dc974:~/project/android/app/build$ unzip -l outputs/apk/beta/release/app-beta-armeabi-v7a-release.apk | head -n 4
Archive: outputs/apk/beta/release/app-beta-armeabi-v7a-release.apk
Length Date Time Name
--------- ---------- ----- ----
28696 1980-00-00 00:00 AndroidManifest.xml
Command executed
bundle exec fastlane beta_deploy
Complete output when running fastlane, including the stack trace and command used
[18:06:35]: ▸ BUILD SUCCESSFUL in 5m 11s [18:06:35]: ▸ 895 actionable tasks: 895 executed [18:06:36]: Cruising back to lane 'android beta_build' 🚘 [18:06:36]: Cruising back to lane 'android beta_deploy' 🚘 tput: No value for $TERM and no -T specified tput: No value for $TERM and no -T specified [18:06:36]: ---------------------------------- [18:06:36]: --- Step: upload_to_play_store --- [18:06:36]: ----------------------------------±------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Summary for supply 2.150.0.rc7 | ±------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | track | alpha | | json_key_data | ******** | | package_name | com.[…].wallet.beta | | apk_paths | [“/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-armeabi-v7a-release.apk”, “/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-x86-release.apk”, “/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-x86_64-release.apk”, “/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-arm64-v8a-release.apk”] | | release_status | completed | | skip_upload_apk | false | | skip_upload_aab | false | | skip_upload_metadata | false | | skip_upload_changelogs | false | | skip_upload_images | false | | skip_upload_screenshots | false | | validate_only | false | | check_superseded_tracks | false | | timeout | 300 | | deactivate_on_promote | true | ±------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[18:06:37]: Preparing apk at path ‘/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-armeabi-v7a-release.apk’ for upload… ±------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Lane Context | ±------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | DEFAULT_PLATFORM | android | | PLATFORM_NAME | android | | LANE_NAME | android beta_deploy | | GRADLE_BUILD_TYPE | Release | | GRADLE_FLAVOR | Beta | | GRADLE_ALL_APK_OUTPUT_PATHS | [“/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-armeabi-v7a-release.apk”, “/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-x86-release.apk”, “/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-x86_64-release.apk”, “/home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-arm64-v8a-release.apk”] | | GRADLE_ALL_AAB_OUTPUT_PATHS | [] | | GRADLE_ALL_OUTPUT_JSON_OUTPUT_PATHS | [“/home/circleci/project/android/app/build/outputs/apk/beta/release/output.json”] | | GRADLE_ALL_MAPPING_TXT_OUTPUT_PATHS | [] | | GRADLE_APK_OUTPUT_PATH | /home/circleci/project/android/app/build/outputs/apk/beta/release/app-beta-x86_64-release.apk | | GRADLE_OUTPUT_JSON_OUTPUT_PATH | /home/circleci/project/android/app/build/outputs/apk/beta/release/output.json | ±------------------------------------±----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ [18:06:45]: Google Api Error: forbidden: APK is not a valid ZIP archive - APK is not a valid ZIP archive
±-----±--------------------------------------------------------------±------------+ | fastlane summary | ±-----±--------------------------------------------------------------±------------+ | Step | Action | Time (in s) | ±-----±--------------------------------------------------------------±------------+ | 1 | default_platform | 0 | | 2 | clean | 91 | | 3 | Switch to android beta_build lane | 0 | | 4 | Switch to android build lane | 0 | | 5 | Switch to android download_s3_assets lane | 0 | | 6 | aws s3 cp s3://prod-wallet-deployment/beta/walletco_mobileapp | 0 | | 7 | load_json | 0 | | 8 | assembleBetaRelease | 311 | | 💥 | upload_to_play_store | 9 | ±-----±--------------------------------------------------------------±------------+
[18:06:45]: fastlane finished with errors
[!] Google Api Error: forbidden: APK is not a valid ZIP archive - APK is not a valid ZIP archive
Exited with code exit status 1
Environment
🚫 fastlane environment 🚫
Stack
Key Value OS 10.15.5 Ruby 2.6.3 Bundler? true Git git version 2.24.3 (Apple Git-128) Installation Source ~/Projects/[…]/Dev/walletco-mobile-app/vendor/bundle/ruby/2.6.0/bin/fastlane Host Mac OS X 10.15.5 (19F101) Ruby Lib Dir /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib OpenSSL Version LibreSSL 2.8.3 Is contained false Is homebrew false Is installed via Fabric.app false Xcode Path /Applications/Xcode.app/Contents/Developer/ Xcode Version 11.5 System Locale
Error No Locale with UTF8 found 🚫 fastlane files:
`./fastlane/Fastfile`
# This file contains the fastlane.tools configuration # You can find the documentation at https://docs.fastlane.tools # # For a list of all available actions, check out # # https://docs.fastlane.tools/actions # # For a list of all available plugins, check out # # https://docs.fastlane.tools/plugins/available-plugins # # Uncomment the line if you want fastlane to automatically update itself # update_fastlane default_platform(:android) platform :android do s3_url = ENV["S3_URL"] desc "Download keystore" private_lane :download_s3_assets do # Download the keystore required to sign the app. key_file = ENV["KEY_FILE"] sh "aws s3 cp #{s3_url}/#{key_file} ../app" end desc "Build" private_lane :build do |options| download_s3_assets package = load_json(json_path: "../package.json") version_code = ENV["CIRCLE_BUILD_NUM"] || 1 version_name = package["version"] || "0.1.0-unknown" build_flavour_option = options[:build_flavor] if build_flavour_option != "Prod" then version_name += "-#{build_flavour_option.downcase}+#{version_code}" end properties = { "versionCode" => version_code, "versionName" => version_name } gradle( task: "assemble", flavor: build_flavour_option, build_type: "Release", flags: "-x :app:lintVital#{build_flavour_option}Release", # we suppress lint because there is a dependency issue see WL-858 properties: properties ) version_code end desc "Beta build" lane :beta_build do version = build(build_name: "[...] Beta", build_flavor: "Beta") version end desc "Submit a new Beta Build to Google Play" lane :beta_deploy do gradle(task: 'clean') ENV["SPLIT_BUILDS"] = 'true' version = beta_build upload_to_play_store( track: 'alpha', json_key_data: ENV['GOOGLE_PLAY_KEY'], package_name: 'com.[...].beta' ) end desc "Production build" lane :prod_build do version = build(build_name: "[...]", build_flavor: "Prod") version end desc "Production deploy" lane :prod_deploy do gradle(task: 'clean') ENV["SPLIT_BUILDS"] = 'true' version = prod_build upload_to_play_store( track: 'beta', json_key_data: ENV['GOOGLE_PLAY_KEY'], ) end end`./fastlane/Appfile`
package_name("[...]")fastlane gems
Gem Version Update-Status fastlane 2.150.0.rc7 ✅ Up-To-Date Loaded fastlane plugins:
Plugin Version Update-Status fastlane-plugin-sentry 1.6.0 ✅ Up-To-Date fastlane-plugin-load_json 0.0.1 ✅ Up-To-Date Loaded gems
Gem Version did_you_mean 1.3.0 bundler 2.1.4 CFPropertyList 3.0.2 concurrent-ruby 1.1.6 i18n 0.9.5 minitest 5.14.0 thread_safe 0.3.6 tzinfo 1.2.7 activesupport 4.2.11.1 public_suffix 4.0.5 addressable 2.7.0 httpclient 2.8.3 json 2.3.1 algoliasearch 1.27.2 atomos 0.1.3 aws-eventstream 1.1.0 aws-partitions 1.337.0 aws-sigv4 1.2.1 jmespath 1.4.0 aws-sdk-core 3.102.1 aws-sdk-kms 1.35.0 aws-sdk-s3 1.72.0 babosa 1.0.3 claide 1.0.3 fuzzy_match 2.0.4 nap 1.1.0 netrc 0.11.0 ffi 1.12.2 ethon 0.12.0 typhoeus 1.3.1 cocoapods-core 1.9.1 cocoapods-deintegrate 1.0.4 cocoapods-downloader 1.3.0 cocoapods-plugins 1.0.0 cocoapods-search 1.0.0 cocoapods-stats 1.1.0 cocoapods-trunk 1.5.0 cocoapods-try 1.2.0 colored2 3.1.2 escape 0.0.4 fourflusher 2.3.1 gh_inspector 1.1.3 molinillo 0.6.6 ruby-macho 1.4.0 nanaimo 0.2.6 xcodeproj 1.17.0 cocoapods 1.9.1 colored 1.2 highline 1.7.10 commander-fastlane 4.4.6 declarative 0.0.20 declarative-option 0.1.0 digest-crc 0.5.1 unf_ext 0.0.7.7 unf 0.1.4 domain_name 0.5.20190701 dotenv 2.7.5 emoji_regex 1.0.1 excon 0.75.0 multipart-post 2.0.0 faraday 1.0.1 http-cookie 1.0.3 faraday-cookie_jar 0.0.6 faraday_middleware 1.0.0 fastimage 2.1.7 jwt 2.1.0 memoist 0.16.2 multi_json 1.14.1 os 1.1.0 signet 0.14.0 googleauth 0.13.0 mini_mime 1.0.2 uber 0.1.0 representable 3.0.4 retriable 3.1.2 google-api-client 0.38.0 google-cloud-env 1.3.2 google-cloud-errors 1.0.1 google-cloud-core 1.5.0 google-cloud-storage 1.26.2 mini_magick 4.10.1 multi_xml 0.6.0 plist 3.5.0 rubyzip 1.3.0 security 0.1.3 naturally 2.2.0 simctl 1.6.8 slack-notifier 2.3.2 terminal-notifier 2.0.0 unicode-display_width 1.7.0 terminal-table 1.8.0 tty-screen 0.8.0 tty-cursor 0.7.1 tty-spinner 0.9.3 word_wrap 1.0.0 rouge 2.0.7 xcpretty 0.3.0 xcpretty-travis-formatter 1.0.0 fastlane-plugin-load_json 0.0.1 fastlane-plugin-sentry 1.6.0 generated on: 2020-07-01
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 33 (5 by maintainers)
I’ve pinned this issue so others can see it. I’m also going to reach inside of Google to see if anybody can find anything for me. I’ll report back if/when I get any info 💪
@alexcroox Re-opened!
I’m also getting this same error today - we had no issues up until Saturday.
works for me tooooooooo
Work for me now.
It seems to be working fine for
aabandapkis failing. At least that is what I observed today.works for me too.
Started seeing this yesterday on Azure DevOps and spent this morning looking into it. It seems to have resolved itself now 😟 I’ve been able to upload an APK no problem from a build produced today.
Subscribing to this I’m using devops too, the last successful upload to Google Play store was Monday 4.30 am
FYI, I found that I was able to get my APK upload to work by manually uploading the build to the Google Play Store using the web UI console. It’s not a great workaround for fastlane users, but it does seem to work, if you need to ship a new build right away.
(But I’m not 100% sure that’s what helped… several people on this thread have reported that the issue went away on its own, so maybe it’s an intermittent issue and I just got lucky. 🍀)
(This could be what finally makes us switch from APKs to AABs.)
Update: it looks like this error is a known error but I’m unsure of why it’s happening or when it’s going to be fixed. I’ll keep you all updated if I find anything else out. But I assume most of you will know things are working before I know.
Do we know if this is only for APKs? Do AABs work fine?
Same, started being an issue today. Updating to
2.151.2hasn’t helped. As above, I’ve verified the APK being generated is fine.Also did work for me, uploaded an
apksuccessfully. Not sure it was a result of a proper fix from Google or I was lucky.For me, I had previously been use aab to assemble pre-fastlane, and after adding fastlane it defaulted to apk, which is when I saw this error. Switched Fastlane to aab in my
lane betablock by changingtask: 'assemble'value totask: 'bundle',