Android configuration-cache not disabling

Bitrise Build Issue Report

Description of the issue

I have two android steps (Lint and UnitTest), and it always fails on the second once due to configuration-cache being used.

I’ve ran each step with both “–no-configuration-cache” and “-Dorg.gradle.unsafe.configuration-cache=false” but it doesn’t appear to be overriding the gradle.properties values

I’ve updated my android project to use configuration-cache (not bitrise cache steps), and have added in a gradle argument -Dorg.gradle.unsafe.configuration-cache=false and/or --no-configuration-cache for each step with the expectation that it would disable the configuration-cache set in gradle.properties.

But i keep receiving

Failed to fetch variants, error: FAILURE: Build failed with an exception.
* What went wrong:
Could not load the value of field `groups` of `org.gradle.api.tasks.diagnostics.internal.DefaultGroupTaskReportModel` bean found in field `tasks` of `org.gradle.api.tasks.diagnostics.TaskReportTask$ProjectReportModel` bean found in field `value` of `org.gradle.internal.Try$Success` bean found in field `projects` of `org.gradle.api.tasks.diagnostics.TaskReportTask$TaskReportModel` bean found in field `value` of `org.gradle.internal.Try$Success` bean found in field `result` of `org.gradle.internal.serialization.Cached$Fixed` bean found in field `model` of task `:tasks` of type `org.gradle.api.tasks.diagnostics.TaskReportTask`.
> java.lang.reflect.InvocationTargetException (no error message)

This is reproducible on a local machine by running this command twice inside your android project

gradlew properties --configuration-cache

Which is due to the properties task not being configuration-cache compatible, and when ran with no configuration cache it builds successfully

gradlew properties --no-configuration-cache

Environment:

Where did the issue happen?

linux-docker-android-20.04

Which build Step causes the issue and which version of the step?

E.g.: Git Clone v3.6.0

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO (No bitrise caching steps used)
  • Does the issue happen sporadically, or every time? : Every time
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : When i implemented configuration-cache into the android project inside gradle.properties

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.
I have reproduced the issue by running this code twice in my android project

gradlew properties --configuration-cache

The first will pass, the second will always fail

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( https://www.bitrise.io/cli )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: http://devcenter.bitrise.io/docker/run-your-build-locally-in-docker/ .
Have not tested locally with CLI

Build log

Please copy paste the build’s bitrise.io URL here (or if the issue happens somewhere else then the full logs), or if you can’t share the url / log here then send the url or full log through a private channel (e.g. email - Contact us ), with a link to the related Discuss issue.
https://app.bitrise.io/build/33d816e9-35bd-4b73-b186-538491d1b22c#?tab=log

Hi @brandon.kitt :smiley:

Can you please submit a ticket regarding this issue to Bitrise Support with a link to this post? Thank you!

Kind regards,
Allene

I have been advised of a bug in the Lint and UnitTest steps where they perform an additional Gradle task first that doesn’t respect the gradle flags.

The workaround advised for now is

  1. Replace your Lint and Unit Test steps with the Gradle Runner step. This step doesn’t have the bug mentioned above and can be configured to achieve the same as the other steps.
  2. Fill in your Gradle tasks. For lint, it’s lintDebug ​and for unit tests it’s testDebugUnitTest​
  3. In the same step input you can append your --no-configuration-cache ​flag.
  4. This step has the same extra features, such as collecting cache and exporting artifacts to $BITRISE_DEPLOY_DIR

Otherwise another work around is to manually remove the configuration folder after each step by running a script before hand to manually delete the configuration cache folder if it exists

rm -r ./.gradle/configuration-cache

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.