Cold starts ran unoptimised: no profileinstaller dependency and no profile in the bundle, so ART interpreted Compose on first launch (class verification measured at 128 bytecodes/s in an emulator ANR). Add the androidx.baselineprofile producer module with an AOSP managed device, a generator covering startup plus the four detail tabs, and commit the generated baseline and startup profiles.
49 lines
1.3 KiB
Kotlin
49 lines
1.3 KiB
Kotlin
plugins {
|
|
alias(libs.plugins.android.test)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.baselineprofile)
|
|
}
|
|
|
|
android {
|
|
namespace = "app.voltplan.cable.baselineprofile"
|
|
compileSdk = 35
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = "11"
|
|
}
|
|
|
|
defaultConfig {
|
|
// Baseline profile capture needs API 33+ on an unrooted device.
|
|
minSdk = 33
|
|
targetSdk = 35
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
targetProjectPath = ":app"
|
|
|
|
// Profiles must be generated on an AOSP image: Play Store images are user
|
|
// builds where the benchmark cannot reset the compilation state.
|
|
testOptions.managedDevices.allDevices {
|
|
create<com.android.build.api.dsl.ManagedVirtualDevice>("pixel6Api34") {
|
|
device = "Pixel 6"
|
|
apiLevel = 34
|
|
systemImageSource = "aosp"
|
|
}
|
|
}
|
|
}
|
|
|
|
baselineProfile {
|
|
managedDevices += "pixel6Api34"
|
|
useConnectedDevices = false
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.androidx.test.ext.junit)
|
|
implementation(libs.androidx.uiautomator)
|
|
implementation(libs.androidx.benchmark.macro.junit4)
|
|
}
|