使用Baseline Profile收集热代码失败,请求技术协助
解决方案
修复代码语法错误
代码中packageName参数的字符串存在两处问题:- 字符串开头多了一个空格
- 字符串未用双引号闭合
修正后的代码片段:
@Test fun startup() = baselineProfileRule.collectBaselineProfile( packageName = "com.xxx.xxx", profileBlock = { startActivityAndWait() device.waitForIdle() } )多渠道项目额外检查项
针对多渠道包场景,还需确认以下配置:- 在Benchmark模块的
build.gradle中,指定对应渠道的测试变体:android { defaultConfig { testInstrumentationRunnerArguments["targetProjectPath"] = ":app" // 替换为你要测试的渠道+构建类型,比如"flavorNameDebug" testInstrumentationRunnerArguments["targetVariant"] = "yourFlavorDebug" } } - 确保测试设备上安装的是对应渠道的应用包,且包名与代码中填写的完全匹配
- 验证应用包与Benchmark测试包的签名一致性,签名不匹配会导致进程访问权限问题
- 在Benchmark模块的
内容的提问来源于stack exchange,提问作者pingan li
相关产品推荐
相关产品推荐

