Exclude multiple APKs


I am building my Android app via the Gradle runner, then I deploy it to Bitrise.io.
The problem is that I also run some integration tests before, so APKs suffixed with -androidTest.apk are also generated, and they get uploaded on the build page which is a thing I would like to avoid.

On the Gradle runner config, I have tried to set the APK file exclude filter to "*-unaligned.apk *-androidTest.apk" or "*-unaligned.apk | *-androidTest.apk" without any effect.

Is there any way to use a list in the APK file exclude filter, or maybe more advanced regex?


1 Like

Hi @fabien_hinge,

No, but you can also change the include filter, if you can provide a pattern there.

Or use multiple Deploy to Bitrise.io steps:

And more info about this in general:

If you have any questions, feel free to ask!

1 Like

What I ended up doing was doing a ruby script to move the stuff I want.
It’s a tiny extra work, but gives you full control of what to output.

That’s mine ruby

#!/usr/bin/env ruby
require 'fileutils'

input_file = "#{input_dir}/app/build/outputs/apk/app-release-unsigned.apk"
output_dir = ENV["BITRISE_DEPLOY_DIR"];
output_file = "#{output_dir}/app-release.apk"
puts "Copying #{input_file} to #{output_file} ..."
FileUtils.cp(input_file, output_file)
cmd = "envman add --key BITRISE_APK_PATH --value #{output_file}"
%x[ #{cmd} ]

Awesome solution @sb_ronaldopace - thanks for sharing!

Indeed this is one of the goals of the step based build configuration, that you can replace or modify any step, as well as add your own “glue” scripts :slight_smile:

Thanks folks, I will give it a try!

As a suggestion, how about adding a “Regex” checkbox, you would add the -regex flag on the find command, and we could input our own regex for the exclude filter.

That’s a great idea @fabien_hinge - feel free to create a #feature-request or an issue on the step’s GitHub page!