Getting this error while running startup baseline benchmarks, according to the error I need to add this dependency in my build.gradle of main android module and it is already added there
implementation("androidx.profileinstaller:profileinstaller:1.3.1")
baselineProfile(project(":baselineprofile"))
Startup Benchmark class:
@RunWith(AndroidJUnit4::class)
@LargeTest
class StartupBenchmarks {
@get:Rule
val rule = MacrobenchmarkRule()
@Test
fun startupCompilationNone() =
benchmark(CompilationMode.None())
@Test
fun startupCompilationBaselineProfiles() =
benchmark(CompilationMode.Partial(BaselineProfileMode.Require))
private fun benchmark(compilationMode: CompilationMode) {
rule.measureRepeated(
packageName = "com.example.android",
metrics = listOf(StartupTimingMetric()),
compilationMode = compilationMode,
startupMode = StartupMode.COLD,
iterations = 10,
setupBlock = {
pressHome()
},
measureBlock = {
startActivityAndWait()
}
)
}}
Error received
java.lang.RuntimeException: The baseline profile install broadcast was not received. This most likely means that the profileinstaller library is missing from the target apk.
at androidx.benchmark.macro.CompilationMode$Partial.compileImpl$benchmark_macro_release(CompilationMode.kt:311)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release(CompilationMode.kt:115)
at androidx.benchmark.macro.CompilationMode.resetAndCompile$benchmark_macro_release$default(CompilationMode.kt:77)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmark(Macrobenchmark.kt:186)
at androidx.benchmark.macro.MacrobenchmarkKt.macrobenchmarkWithStartupMode(Macrobenchmark.kt:388)
at androidx.benchmark.macro.junit4.MacrobenchmarkRule.measureRepeated(MacrobenchmarkRule.kt:107)
at com.example.baselineprofile.StartupBenchmarks.benchmark(StartupBenchmarks.kt:49)
at com.example.baselineprofile.StartupBenchmarks.startupCompilationBaselineProfiles(StartupBenchmarks.kt:46)
Any help would be very appreciated, Thanks!