我正在Android应用上运行覆盖任务。我在build.gradle文件中添加了必要的命令testCoverageEnabled = true
。我可以在./gradlew任务列表中看到任务createMockDebugAndroidTestCoverageReport。我执行了createMockDebugAndroidTestCoverageReport任务,并在控制台上收到以下错误:
* What went wrong:
Execution failed for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'.
> java.io.IOException: No coverage data to process in directory '/Users/aaa.bbb/Documents/myApp-android/myAppApplication/build/outputs/code-coverage/connected/flavors/MOCK'
当我检查此路径时,它为空。
调试日志代码段是:
23:42:33.589 [QUIET] [system.out] 11:42:33 I/XmlResultReporter: XML test result file generated at /Users/aaa.bbb/Documents/myApp-android/myAppApplication/build/outputs/androidTest-results/connected/flavors/MOCK/TEST-Nexus_5X_API_27_Automation-2(AVD) - 8.1.0-myAppApplication-MOCK.xml. Total tests 15, passed 15,
23:42:33.589 [QUIET] [system.out] 11:42:33 V/ddms: execute 'CLASSPATH=$(pm path android.support.test.services) app_process / android.support.test.services.shellexecutor.ShellMain am instrument -r -w -e targetInstrumentation com.chn.myApp.test/android.support.test.runner.AndroidJUnitRunner -e coverageFilePath /data/data/com.chn.myApp/coverage_data/ -e coverage true android.support.test.orchestrator/android.support.test.orchestrator.AndroidTestOrchestrator' on 'emulator-5556' : EOF hit. Read: -1
23:42:33.590 [QUIET] [system.out] 11:42:33 V/ddms: execute: returning
23:42:33.590 [INFO] [org.gradle.api.Task] DeviceConnector 'Nexus_5X_API_27_Automation-2(AVD) - 8.1.0': fetching coverage dir from /data/data/com.chn.myApp/coverage_data/
23:42:33.590 [QUIET] [system.out] 11:42:33 V/ddms: execute: running echo 'for i in $(run-as com.chn.myApp ls /data/data/com.chn.myApp/coverage_data/); do run-as com.chn.myApp cat /data/data/com.chn.myApp/coverage_data/$i > /data/local/tmp/com.chn.myApp-coverage_data/$i; done' > /data/local/tmp/com.chn.myApp-coverage_data/copyFromUser.sh
23:42:33.630 [QUIET] [system.out] 11:42:33 V/ddms: execute 'echo 'for i in $(run-as com.chn.myApp ls /data/data/com.chn.myApp/coverage_data/); do run-as com.chn.myApp cat /data/data/com.chn.myApp/coverage_data/$i > /data/local/tmp/com.chn.myApp-coverage_data/$i; done' > /data/local/tmp/com.chn.myApp-coverage_data/copyFromUser.sh' on 'emulator-5556' : EOF hit. Read: -1
23:42:33.630 [QUIET] [system.out] 11:42:33 V/ddms: execute: returning
23:42:33.631 [QUIET] [system.out] 11:42:33 V/ddms: execute: running sh /data/local/tmp/com.chn.myApp-coverage_data/copyFromUser.sh
23:42:33.668 [QUIET] [system.out] 11:42:33 V/ddms: execute 'sh /data/local/tmp/com.chn.myApp-coverage_data/copyFromUser.sh' on 'emulator-5556' : EOF hit. Read: -1
23:42:33.668 [QUIET] [system.out] 11:42:33 V/ddms: execute: returning
23:42:33.669 [QUIET] [system.out] 11:42:33 V/ddms: execute: running ls /data/local/tmp/com.chn.myApp-coverage_data > /data/local/tmp/com.chn.myApp-coverage_data/paths.txt
23:42:33.711 [QUIET] [system.out] 11:42:33 V/ddms: execute 'ls /data/local/tmp/com.chn.myApp-coverage_data > /data/local/tmp/com.chn.myApp-coverage_data/paths.txt' on 'emulator-5556' : EOF hit. Read: -1
23:42:33.711 [QUIET] [system.out] 11:42:33 V/ddms: execute: returning
23:42:33.711 [QUIET] [system.out] 11:42:33 D/paths.txt: Downloading paths.txt from device 'emulator-5556'
23:42:33.723 [QUIET] [system.out] 11:42:33 D/Device: Downloading file from device 'emulator-5556'
23:42:33.735 [QUIET] [system.out] 11:42:33 V/ddms: execute: running rm -r /data/local/tmp/com.chn.myApp-coverage_data
23:42:33.776 [QUIET] [system.out] 11:42:33 V/ddms: execute 'rm -r /data/local/tmp/com.chn.myApp-coverage_data' on 'emulator-5556' : EOF hit. Read: -1
23:42:33.776 [QUIET] [system.out] 11:42:33 V/ddms: execute: returning
23:42:33.778 [INFO] [org.gradle.api.Task] DeviceConnector 'Nexus_5X_API_27_Automation-2(AVD) - 8.1.0': uninstalling com.chn.myApp.test
23:42:33.778 [QUIET] [system.out] 11:42:33 V/ddms: execute: running pm uninstall com.chn.myApp.test
23:42:34.133 [QUIET] [system.out] 11:42:34 V/ddms: execute 'pm uninstall com.chn.myApp.test' on 'emulator-5556' : EOF hit. Read: -1
23:42:34.133 [QUIET] [system.out] 11:42:34 V/ddms: execute: returning
23:42:34.133 [INFO] [org.gradle.api.Task] DeviceConnector 'Nexus_5X_API_27_Automation-2(AVD) - 8.1.0': uninstalling com.chn.myApp
23:42:34.133 [QUIET] [system.out] 11:42:34 V/ddms: execute: running pm uninstall com.chn.myApp
23:42:34.518 [QUIET] [system.out] 11:42:34 V/ddms: execute 'pm uninstall com.chn.myApp' on 'emulator-5556' : EOF hit. Read: -1
23:42:34.518 [QUIET] [system.out] 11:42:34 V/ddms: execute: returning
23:42:34.548 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Execute runTests for :myAppApplication:connectedMockDebugAndroidTest'
23:42:34.548 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Execute runTests for :myAppApplication:connectedMockDebugAndroidTest' completed
23:42:34.548 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property coverageDir (OUTPUT) for task ':myAppApplication:connectedMockDebugAndroidTest'
23:42:34.549 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
23:42:34.549 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':myAppApplication:connectedMockDebugAndroidTest'
23:42:34.549 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Task :myAppApplication:connectedMockDebugAndroidTest'
23:42:34.550 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Task :myAppApplication:connectedMockDebugAndroidTest' completed
23:42:34.550 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :myAppApplication:connectedMockDebugAndroidTest (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 29.011 secs.
23:42:34.550 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.23 completed (1 worker(s) in use)
23:42:34.550 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':' Thread 7: released lock on root.1.23
23:42:34.550 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':' Thread 7: released lock on :
23:42:34.551 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':' Thread 7: acquired lock on :
23:42:34.551 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.23 started (1 worker(s) in use).
23:42:34.551 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':' Thread 7: acquired lock on root.1.23
23:42:34.551 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :myAppApplication:createMockDebugAndroidTestCoverageReport (Thread[Task worker for ':' Thread 7,5,main]) started.
23:42:34.551 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Task :myAppApplication:createMockDebugAndroidTestCoverageReport' started
23:42:34.551 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :myAppApplication:createMockDebugAndroidTestCoverageReport
23:42:34.551 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.552 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Putting task artifact state for task ':myAppApplication:createMockDebugAndroidTestCoverageReport' into context took 0.0 secs.
23:42:34.552 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ':myAppApplication:createMockDebugAndroidTestCoverageReport' is up-to-date
23:42:34.552 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Implementation for task ':myAppApplication:createMockDebugAndroidTestCoverageReport': com.android.build.gradle.internal.coverage.JacocoReportTask_Decorated@42f81559c641aa92389da2b264b5f09f
23:42:34.552 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Action implementations for task ':myAppApplication:createMockDebugAndroidTestCoverageReport': [com.android.build.gradle.internal.coverage.JacocoReportTask_Decorated@42f81559c641aa92389da2b264b5f09f]
23:42:34.553 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property classFileCollection (ABSOLUTE) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.595 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property coverageDirectory (ABSOLUTE) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.595 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property coverageFile (ABSOLUTE) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.595 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property jacocoClasspath (ABSOLUTE) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.595 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Resolve files of :myAppApplication:androidJacocoAnt' started
23:42:34.595 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Resolve files of :myAppApplication:androidJacocoAnt'
23:42:34.595 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Resolve files of :myAppApplication:androidJacocoAnt' completed
23:42:34.596 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property sourceFolders (ABSOLUTE) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.620 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property reportDir (OUTPUT) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.621 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] No discovered inputs for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.621 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Task ':myAppApplication:createMockDebugAndroidTestCoverageReport' is not up-to-date because:
Task has failed previously.
23:42:34.621 [DEBUG] [org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter] Ensuring directory exists for property reportDir (OUTPUT) at /Users/aaa.bbb/Documents/myApp-android/myAppApplication/build/reports/coverage/mock/debug
23:42:34.621 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'.
23:42:34.621 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Execute generateReport for :myAppApplication:createMockDebugAndroidTestCoverageReport' started
23:42:34.622 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Execute generateReport for :myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.622 [DEBUG] [org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository] Snapshotting property reportDir (OUTPUT) for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.623 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
23:42:34.623 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.623 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :myAppApplication:createMockDebugAndroidTestCoverageReport FAILED
23:42:34.623 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Task :myAppApplication:createMockDebugAndroidTestCoverageReport'
23:42:34.623 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Task :myAppApplication:createMockDebugAndroidTestCoverageReport' completed
23:42:34.623 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :myAppApplication:createMockDebugAndroidTestCoverageReport (Thread[Task worker for ':' Thread 7,5,main]) completed. Took 0.072 secs.
23:42:34.623 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.23 completed (1 worker(s) in use)
23:42:34.623 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':' Thread 7: released lock on root.1.23
23:42:34.624 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':' Thread 7: released lock on :
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 7,5,main]] finished, busy: 30.443 secs, idle: 25.235 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 5,5,main]] finished, busy: 0.0 secs, idle: 55.678 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 2,5,main]] finished, busy: 4.917 secs, idle: 50.762 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 7,5,main]] finished, busy: 0.719 secs, idle: 54.959 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 3,5,main]] finished, busy: 0.0 secs, idle: 55.679 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':',5,main]] finished, busy: 19.484 secs, idle: 36.195 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 4,5,main]] finished, busy: 0.0 secs, idle: 55.679 secs
23:42:34.624 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':' Thread 6,5,main]] finished, busy: 0.0 secs, idle: 55.678 secs
23:42:34.626 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Run tasks'
23:42:34.630 [LIFECYCLE] [org.gradle.internal.buildevents.BuildResultLogger] 58 actionable tasks: 11 executed, 47 up-to-date
23:42:34.630 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1 completed (0 worker(s) in use)
23:42:34.630 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Daemon worker Thread 7: released lock on root.1
23:42:34.631 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Run build'
23:42:34.633 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file content cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/fileContent)
23:42:34.634 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file content cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/fileContent).
23:42:34.636 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for task history cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/taskHistory)
23:42:34.636 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache taskHistory.bin (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/taskHistory/taskHistory.bin)
23:42:34.637 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on task history cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/taskHistory).
23:42:34.638 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for Build Output Cleanup Cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/buildOutputCleanup)
23:42:34.639 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache outputFiles.bin (/Users/aaa.bbb/Documents/myApp-android/.gradle/buildOutputCleanup/outputFiles.bin)
23:42:34.639 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on Build Output Cleanup Cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/buildOutputCleanup).
23:42:34.640 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 0 (avg: 0.0 secs, total: 0.0 secs)
23:42:34.641 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory] Resolution result cache closed. Cache reads: 0, disk reads: 1 (avg: 0.0 secs, total: 0.0 secs)
23:42:34.644 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.ResolutionResultsStoreFactory] Deleted 8 resolution results binary files in 0.004 secs
23:42:34.645 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopping 0 deployment handles
23:42:34.645 [DEBUG] [org.gradle.deployment.internal.DefaultDeploymentRegistry] Stopped deployment handles
23:42:34.645 [INFO] [org.gradle.cache.internal.DefaultPersistentDirectoryCache] VCS Checkout Cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/vcsWorkingDirs) has not been cleaned up in 6 days
23:42:34.645 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache VCS Checkout Cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/vcsWorkingDirs) was closed 0 times.
23:42:34.647 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for Artifact transforms cache (/Users/aaa.bbb/.gradle/caches/transforms-1)
23:42:34.648 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on Artifact transforms cache (/Users/aaa.bbb/.gradle/caches/transforms-1).
23:42:34.649 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Cache Generated Gradle JARs cache (/Users/aaa.bbb/.gradle/caches/4.6/generated-gradle-jars) was closed 0 times.
23:42:34.650 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for file hash cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/fileHashes)
23:42:34.650 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache fileHashes.bin (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/fileHashes/fileHashes.bin)
23:42:34.650 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache resourceHashesCache.bin (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/fileHashes/resourceHashesCache.bin)
23:42:34.650 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on file hash cache (/Users/aaa.bbb/Documents/myApp-android/.gradle/4.6/fileHashes).
23:42:34.650 [DEBUG] [org.gradle.cache.internal.LockOnDemandCrossProcessCacheAccess] Releasing file lock for artifact cache (/Users/aaa.bbb/.gradle/caches/modules-2)
23:42:34.651 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (/Users/aaa.bbb/.gradle/caches/modules-2/metadata-2.53/module-metadata.bin)
23:42:34.651 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-artifact.bin (/Users/aaa.bbb/.gradle/caches/modules-2/metadata-2.53/module-artifact.bin)
23:42:34.651 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-artifacts.bin (/Users/aaa.bbb/.gradle/caches/modules-2/metadata-2.53/module-artifacts.bin)
23:42:34.651 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-versions.bin (/Users/aaa.bbb/.gradle/caches/modules-2/metadata-2.53/module-versions.bin)
23:42:34.651 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/Users/aaa.bbb/.gradle/caches/modules-2).
23:42:34.652 [DEBUG] [org.gradle.launcher.daemon.server.exec.ExecuteBuild] The daemon has finished executing the build.
23:42:34.709 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientInputForwarder] Dispatching close input message: org.gradle.launcher.daemon.protocol.CloseInput@11a6bbff
23:42:34.710 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 14: dispatching class org.gradle.launcher.daemon.protocol.CloseInput
23:42:34.711 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClient] Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':myAppApplication:createMockDebugAndroidTestCoverageReport'.] from daemon DaemonInfo{pid=62252, address=[7ce05240-217b-4229-8733-a8232ac82e03 port:52343, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1550549963706, context=DefaultDaemonContext[uid=6f5c8d7a-ef3c-40e2-8dea-36fe53c960bb,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home,daemonRegistryDir=/Users/aaa.bbb/.gradle/daemon,pid=62252,idleTimeout=10800000,daemonOpts=-Xmx1536m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
23:42:34.711 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: dispatching class org.gradle.launcher.daemon.protocol.Finished
23:42:34.713 [DEBUG] [org.gradle.launcher.daemon.client.DaemonClientConnection] thread 1: connection stop
当我检查以下路径时:/Users/aaa.bbb/Documents/myApp-android/myAppApplication/build/reports/coverage/mock/debug在我的本地计算机上(我有Android Studio的地方)
它是空的。因此,我认为,此路径中没有数据可以处理覆盖率。
但是,当我看到设备(ddms)登录上面的调试代码片段时,我可以看到coverageFilePath = /data/data/com.chn.myApp/coverage_data/,并且当我在设备上检查此路径时,它确实不存在。 (com.chn.myApp文件夹不存在)。另外,我看不到此文件夹的删除命令,因此作为退出过程的一部分,该文件夹从设备中删除的可能性不大。因此,我想这应该是设备上未生成覆盖率报告的问题,但不确定为什么不创建此文件夹(设备上存储覆盖率信息的文件夹)。我正在使用Android模拟器。
任何指导表示赞赏!
答案 0 :(得分:4)
我知道已经晚了。但是我遇到了同样的问题,我相信其他人也会遇到同样的问题。
我想您正在关注Google的文档并使用ANDROIDX_TEST_ORCHESTRATOR
:
https://developer.android.com/training/testing/junit-runner.html#using-android-test-orchestrator
如果是,则IOException是Google在ANDROIDX_TEST_ORCHESTRATOR
中的错误
https://issuetracker.google.com/issues/72758547
我所做的只是发表评论
//execution 'ANDROIDX_TEST_ORCHESTRATOR'
它应该能够生成代码覆盖率。
希望这会有所帮助
编辑1 / Dec / 2020
似乎Google修复了Android Gradle插件3.2.0-alpha17中的问题。
https://issuetracker.google.com/issues/72758547#comment17
使用com.android.tools.build:gradle:4.1.1
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
ANDROIDX_TEST_ORCHESTRATOR起作用。
答案 1 :(得分:4)
我发现将Gradle版本降级为6.3可解决此问题。
答案 2 :(得分:0)
尝试运行createMockDebugAndroidTestCoverageReport
,然后运行connectedMockDebugAndroidTest
,而不是jacocoTestReport
:
$ ./gradlew :myAppApplication:connectedMockDebugAndroidTest
$ ./gradlew :myAppApplication:jacocoTestReport