Failed to fetch variants, error: FAILURE: Build failed with an exception

Hi there,

I’m having some trouble with my gradle builds in bitrise, as its running fine locally, but always fails on bitrise.

I have two steps that are “an issue” - AndroidLint and AndroidUnitTest

Whichever order I put them in, the first step passes and the second step fails, so I can run it with lint first and unit test second and the unit test step will fail, or the unit test first and lint second and the lint step will fail, all with the same build exception

Variants:
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)

I’ve tried with specific modules, with all modules (none specified), as well as specific variants and all variants (none specified), as well as with and without “–no-configuration-cache” specified in the steps, as I have build cache and configuration cache enabled in my gradle.properties file.

Please help.

I have found the cause. Its due to this issue with configuration cache

Currently running two synchronously with configure cache enabled will result in this error.
It appears that the “–no-configuration-cache” is not working as well. (Whether I haven’t set it up correctly, will need to look into).

So disabling configuration cache / caching for those steps will be required until this issue is resolved.