If you want to calculate the coverage of AndroidTest, you only need to add the coverage statistics to the buildTypes closure in the module's build.gradle
debug {
testCoverageEnabled true
}
To generate a report, you can find the Gradle menu in AS, find verification -> createDebugCoverageReport, right click and run this task.
If this is displayed after configuration,
click to enter:
Uncheck it, and you can see the task list after synchronization