measure-builds-gradle-plugin icon indicating copy to clipboard operation
measure-builds-gradle-plugin copied to clipboard

Do not crash if `buildMetricsPreparedAction` null

Open wzieba opened this issue 1 year ago • 1 comments

User reports that sometimes they experience lateinit property buildMetricsPreparedAction has not been initialized error, fixed by Android Studio/IntelliJ Gradle sync.

The root cause of this problem is not known at this moment, but it'll be better to warn client about it, rather than crashing the build.

wzieba avatar May 06 '24 11:05 wzieba

It is a somewhat challenging problem. When it occurs, we can work around this by using rm -rf .gradle/configuration-cache as mentioned in the documentation ( https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:invalidate ).

takahirom avatar Jul 10 '24 02:07 takahirom

I hit this issue fairly often, and feel like it happens when I run a task which has all the tasks already cached (so nothing actually gets run). I sort it out by picking a task and running with the --rerun-tasks flag in gradle.

Is there a github issue for this?

jd565 avatar Sep 23 '24 08:09 jd565

@wzieba Is there a reason not to merge this? Would greatly appreciate a new release with this change in

jd565 avatar Sep 24 '24 09:09 jd565

hi there 👋 There's no actual reason to not merge this - I can do this. I thought I'll be able to address this issue in a more meaningful way than this, but for now, I think I agree it's better to not crash the plugin.

Thanks @takahirom for the suggestion. Whenever I'll have some time, I'll try to follow up on this to find some satisfying solution.

wzieba avatar Sep 24 '24 10:09 wzieba

@jd565 Plugin in version 3.1.1 is now available via Gradle's plugin portal

wzieba avatar Sep 24 '24 11:09 wzieba