Add AndroidTest build type for all flavors in whitelabel app

140
May 10, 2022, at 07:40 AM

I have a whitelabel Android app, that uses flavors to build the different variants. I have setup the application so that all variants are built with fastlane, and everything works correctly except when it comes to AndroidTest, and its usage to generate screenshots.

According to fastlane's docs (see section Generating Screenshots with Screengrab) I should be able to run the following gradle tasks and get a build ready for screenshots to be taken:

gradle(task: "clean")
  
gradle(
   task: 'assemble',
   flavor: options[:flavor],
   build_type: 'Debug'
)
gradle(
   task: 'assemble',
   flavor: options[:flavor],
   build_type: 'AndroidTest'
)

The first two actions work without issues, the problem is the third one where the gralde task generated looks like this: assemble<flavour>AndroidTest, where <flavour> is the name of the flavour I am trying to build. The problem is that there isn't a gradle task for each of the flavours, but a generic one called assembleAndroidTest.

How can I add a gradle task (possibly automatically), that follows the pattern above, for each of the flavors in my project?

EDIT

I may have found a solution, although I am not sure this is correct:

gradle(
  task: 'assemble',
  flavor: options[:flavor],
  build_type: 'DebugAndroidTest'
)

By setting the build type to be DebugAndroidTest it works, although I not sure whether I will run into issues down the road.

Could it be a workaround though?

Rent Charter Buses Company
READ ALSO
IOS problem to discover services when using flutter_blue package

IOS problem to discover services when using flutter_blue package

I'm working on a project that requires the app I am developing with Flutter to connect to the Raspberry pi via Bluetooth and be able to send and receive data

77
How can I properly initialize my Android emulator using AVD?

How can I properly initialize my Android emulator using AVD?

I'm trying to run an Android emulator from command-line because I couldn't run it from Android Studio (it gave the same problem plus some error messages such as "Time out after 300seconds waiting for emulator to come online" and "The emulator...

131
Android Studio - RecyclerView with API level 19 (API 19)

Android Studio - RecyclerView with API level 19 (API 19)

I need to use RecyclerView with API 19 (API level 19)

100
GMail composer links don&#39;t work on Android

GMail composer links don't work on Android

I am using GMail links like

108