In my case, it was solved when I upgraded toolVersion in:
toolVersion
jacoco { toolVersion = "0.8.13" }