You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Baseline Profile收集热代码失败,请求技术协助

解决方案

  1. 修复代码语法错误
    代码中packageName参数的字符串存在两处问题:

    • 字符串开头多了一个空格
    • 字符串未用双引号闭合
      修正后的代码片段:
    @Test
    fun startup() = baselineProfileRule.collectBaselineProfile(
        packageName = "com.xxx.xxx",
        profileBlock = {
            startActivityAndWait()
            device.waitForIdle()
        }
    )
    
  2. 多渠道项目额外检查项
    针对多渠道包场景,还需确认以下配置:

    • 在Benchmark模块的build.gradle中,指定对应渠道的测试变体:
      android {
          defaultConfig {
              testInstrumentationRunnerArguments["targetProjectPath"] = ":app"
              // 替换为你要测试的渠道+构建类型,比如"flavorNameDebug"
              testInstrumentationRunnerArguments["targetVariant"] = "yourFlavorDebug"
          }
      }
      
    • 确保测试设备上安装的是对应渠道的应用包,且包名与代码中填写的完全匹配
    • 验证应用包与Benchmark测试包的签名一致性,签名不匹配会导致进程访问权限问题

内容的提问来源于stack exchange,提问作者pingan li

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.26 00:48:24