Successfully overwrote file: /home/Messier82/projects/service-book/app/build.gradle.kts. Here is the updated code: ... it.contains("generateGmdCoverage", ignoreCase = true) } val screenshotTestPackage = "com.yorvana.screenshots" /** * When -PscreenshotBuild is passed, we switch the instrumentation test environment to 'release'. * This ensures that store screenshots are captured from the production-representative minified build. * General unit testing and coverage remains on 'debug' for stability. */ val isScreenshotBuild = project.hasProperty("screenshotBuild") val testVariant = if (isScreenshotBuild) "release" else "debug" val testVariantCap = testVariant.replaceFirstChar { it.uppercase() } android { namespace = "com.yorvana" compileSdk = 36 defaultConfig { ... vectorDrawables { useSupportLibrary = true } } testBuildType = testVariant signingConfigs { create("release") { storeFile = rootProject.file("app/${keystoreProperties["storeFile"] ?: System.getenv("KEYSTORE_FILE") ?: ""}") storePassword = (keystoreProperties["storePassword"] ?: System.getenv("KEYSTORE_PASSWORD") ?: "").toString() ... allDevices { create("pixel2api33") { device = "Pixel 2" apiLevel = 33 systemImageSource = "aosp" testedAbi = "x86_64" } create("phonePixel6api34") { device = "Pixel 6" apiLevel = 34 systemImageSource = "aosp" ... else -> null } if (deviceDirName != null) { // Set the host-side directory where GMD will pull files from. getAdditionalTestOutputDir().set( layout.buildDirectory.dir("outputs/managed_device_android_test_additional_output/$testVariant/$deviceDirName"), ) } // AGP does not provide a public DSL to set per-ManagedVirtualDevice instrumentation arguments. // We use reflection to reach into the internal testData property and its instrumentationRunnerArguments map. ... val map = mutableMapOf() when { taskName.contains("phonePixel6api34", ignoreCase = true) -> { map["package"] = screenshotTestPackage map["additionalTestOutputDir"] = "/sdcard/test-outputs/screenshots" // Hide developer panel even if we are in a debug build (when -PscreenshotBuild is NOT used) map["hideDeveloperPanel"] = "true" } taskName.contains("tablet7Nexus7api34", ignoreCase = true) -> { map["package"] = screenshotTestPackage map["additionalTestOutputDir"] = "/sdcard/test-outputs/screenshots" ... tasks.register("generateGmdCoverage") { group = "Verification" description = "Runs GMD tests and copies the coverage file to the baseline directory." // Coverage is always collected from the debug variant of the smoke device val smokeTask = "pixel2api33${testVariantCap}AndroidTest" dependsOn(smokeTask) from(layout.buildDirectory.dir("outputs/managed_device_code_coverage/$testVariant/pixel2api33")) { include("coverage.ec") } into(layout.projectDirectory.dir("coverage-baselines")) rename { "gmd_smoke.ec" } ... "screen_06_paywall_dialog.png", ) val storeScreenshotsRoot = rootProject.layout.projectDirectory.dir("distribution/store-assets/screenshots") val storeAdditionalOutputRoots = listOf( layout.buildDirectory.dir("outputs/managed_device_android_test_additional_output/$testVariant"), ) fun registerStoreScreenshotCopy( taskPrefix: String, deviceTaskName: String, ... } val copyPhoneStoreScreenshots = registerStoreScreenshotCopy( taskPrefix = "Phone", deviceTaskName = "phonePixel6api34${testVariantCap}AndroidTest", outputDirectory = "phone", ) val copyTablet7StoreScreenshots = registerStoreScreenshotCopy( taskPrefix = "Tablet7", deviceTaskName = "tablet7Nexus7api34${testVariantCap}AndroidTest", outputDirectory = "tablet-7", previousCopyTask = copyPhoneStoreScreenshots, ) val copyTablet10StoreScreenshots = registerStoreScreenshotCopy( taskPrefix = "Tablet10", deviceTaskName = "tablet10PixelTabletApi34${testVariantCap}AndroidTest", outputDirectory = "tablet-10", previousCopyTask = copyTablet7StoreScreenshots, ) tasks.register("generateStoreScreenshots") { ... tasks.register("verifyWithCoverage") { group = "Verification" description = "Runs JVM unit tests and generates a combined coverage report using JaCoCo with the static GMD baseline." // Unit tests are variant-agnostic; we always use debug for coverage consistency dependsOn("testDebugUnitTest") reports { xml.required.set(true) html.required.set(true) ...