Bug 40123: Allow building the instrumented tests apks for variants other than debug

This allows to specify the variant of the instrumented tests via
a `testBuildType` gradle argument. It also applies a workaround for
a R8 issue from https://issuetracker.google.com/issues/140851070.
latest
Status Job ID Name Coverage
  Build
failed buildDebug #8591
32GB

 
  Test
skipped testLight #8592
32GB
 
Name Stage Failure
failed
buildDebug Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log