生成Release版本Baseline Profile时遇启动确认异常求助
Release构建变体生成Baseline Profiles时抛出启动完成确认异常
我正在为应用实现Baseline Profiles,按照官方视频步骤操作时,Debug构建变体可成功生成baseline-prof.txt以优化启动时间,但切换为Release配置运行基准测试时,出现如下异常。
执行命令
./gradlew :macrobenchmark:pixel2Api31BenchmarkAndroidTest -P android.testInstrumentationRunnerArguments.class=com.example.BaselineProfileGenerator
异常信息
com.example.BaselineProfileGenerator > generate[pixel2Api31] FAILED java.lang.IllegalStateException: Unable to confirm activity launch completion [] Please report a bug with the output of `adb shell dumpsys gfxinfo com.leinardi.forlago framestats` at androidx.benchmark.macro.MacrobenchmarkScope.startActivityImpl(MacrobenchmarkScope.kt:179) Tests on pixel2Api31 failed: There was 1 failure(s).
基准测试代码
@OptIn(ExperimentalBaselineProfilesApi::class) @RunWith(AndroidJUnit4ClassRunner::class) class BaselineProfileGenerator { @get:Rule val rule = BaselineProfileRule() @Test fun generate() { rule.collectBaselineProfile("com.leinardi.forlago") { pressHome() startActivityAndWait() } } }
构建配置
- Debug配置(运行正常):
benchmark { initWith buildTypes.debug signingConfig signingConfigs.debug matchingFallbacks = ['debug'] debuggable false proguardFiles('benchmark-rules.pro') }
- Release配置(抛出异常):
benchmark { initWith buildTypes.release signingConfig signingConfigs.debug matchingFallbacks = ['release'] debuggable false proguardFiles('benchmark-rules.pro') }
环境信息
- 使用组件:Baseline Profiles
- 版本信息:AGP=7.3.0-rc01,uiautomator=2.2.0,benchmark-macro-junit4=1.1.0
- 测试设备配置:
testOptions { managedDevices { devices { pixel2Api31(com.android.build.api.dsl.ManagedVirtualDevice) { device = "Pixel 2" apiLevel = 31 systemImageSource = "aosp" } } } }
内容的提问来源于stack exchange,提问作者J.Arroyo
相关产品推荐
相关产品推荐

