Fastlane Supply uploads everything!

05 September, 2017

Ever since I found out about fastlane, I've been using it to deploy Android and iOS apps. It's amazing how streamlined things can get: it saves you a bunch of time when deploying a release; it supports integrations with your favorite distribution platforms (yay Crashlytics); and you can easily copy the setup from one app to the other! Couldn't be happier with it.

Here's a tip for the Android devs out there using fastlane, add this to your before_all step:

before *all do
  sh "rm -f ../app/build/outputs/apk/*/\_/\*.apk"

I've found that when deploying Android builds using supply, the tool tries to upload whatever it can find in your build/outputs folder. And often the error you get are unrelated like:

Google Api Error: apkUpgradeVersionConflict:
APK specifies a version code that has already been used.

This is obviously not true if you check your google play console and your build.gradle file. Looking at the output the (at the GRADLE_ALL_APK_OUTPUT_PATHS variable), it seems supply is trying to upload every apk he finds, including debugging version and other flavors. Adding that line will save you some time and stop you from screaming "Why don't the versions match??"

Thank you for reading

Please get in touch if you have a suggestion, find an issue or want to say hello.