The benchmark runs correctly, but in the final stage, when it was supossed to generate .json and .trace, it throws an exception.
java.lang.IllegalArgumentException: Unable to read any metrics during benchmark (metric list: [androidx.benchmark.macro.StartupTimingMetric@d04ea05]).
Check that you're performing the operations to be measured. For example, if
using StartupTimingMetric, are you starting an activity for the specified package
in the measure block?
Code:
benchmarkRule.measureRepeated(
packageName = TARGET_PACKAGE,
metrics = listOf(StartupTimingMetric()),
iterations = DEFAULT_ITERATIONS,
startupMode = StartupMode.COLD,
compilationMode = compilationMode,
setupBlock = {
//Not important
},
) {
startActivityAndWait()
BrowsePage(this) {
waitAppear()
}
device.waitForIdle()
}
Expecting: Run benchmarks and create the logs correctly.