'JaCoCo + Mockito + Android test - On jenkins jacoco is getting stuck

I've got a problem when I launch a build on Jenkins. I would like to have the coverage report of my instrumented tests in Jenkins but it is stuck while executing Jacoco Test reports. In my Android project, I've added the line apply plugin: 'jacoco' in the app/build.gradle file. I have used,

gradle plugin version- 7.0.2
Kotlin version - 1.4.32
jacoco version - 0.8.7
build gradle - 4.2.2

Previously it was working with below mention configuration:

 gradle plugin version- 6.5
 Kotlin version - 1.4.32
 jacoco version - 0.8.7
 build gradle - 4.1.3

And I have used Robolectric and Hilt in my project and in test cases. Locally it is working fine. Only in jenkins it is getting stuck. Please help me out what I have missed.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source