My Face

Olá! I'm Luis

I'm a software developer building mobile native apps and writing about what I learn.

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 favourite 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"
end

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??"