I have been struggling on this for past 2 days. There are several solutions on stack overflow which didn't work for me. I am trying to ignore gradle task for prod environment. To execute my task i.e. dokkaHtml on build, I am using this command -
tasks.named('preBuild') { finalizedBy(dokkaHtml) }
Is there a way to disable dokkaHtml task when running on different build variant(eg - ignore the task for production builds)?
You could try to connect dokka task to a flavor-specific
preBuild
, so in your case, it would be something like this:This way you omit dokka for the prod flavor.