Hi,
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?
Thanks
Fabien
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:
Our Android project on bitrise is a library (.aar file) and together with it there’s a minimum implementation app that we also use for integration tests (.apk file).
I’m trying to find a way to output both the library and application files.
Before we’re doing just the library and the “APK file include filter” was simple: release.aar
Now to output both I’ve tried *release*.apk$|*release.aar$
Needles to say it didn’t work, or else I would be here asking about it.
What would be the best way to…
And more info about this in general:
Here’s how you can configure your project to only deploy specific APK(s), and not all of the APKs generated during the Android/Gradle build:
Note: of course to actually deploy an APK you’ll need a deploy step to be included in your Workflow, after the step which generated the APK, e.g. a Deploy to Bitrise.io step after the Gradle Runner step.
Specify in your Gradle configs
You can tweak your Gradle configs to not to generate that APK for the task you run.
If you run the assemble gradle task,…
If you have any questions, feel free to ask!
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_dir = ENV["BITRISE_SOURCE_DIR"]
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
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!