plugins { alias(libs.plugins.android.test) alias(libs.plugins.baselineprofile) } android { namespace = "io.legado.baselineprofile" compileSdk { version = release(36) { minorApiLevel = 1 } } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } defaultConfig { minSdk = 28 targetSdk = 37 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "DEBUGGABLE" } targetProjectPath = ":app" flavorDimensions += listOf("mode") productFlavors { create("app") { dimension = "mode" } } } // This is the configuration block for the Baseline Profile plugin. // You can specify to run the generators on a managed devices or connected devices. baselineProfile { // managedDevices += "pixel6Api34" useConnectedDevices = true } dependencies { implementation(libs.androidx.benchmark.macro.junit4) implementation(libs.androidx.espresso.core) implementation(libs.androidx.junit) implementation(libs.androidx.uiautomator) } androidComponents { beforeVariants { v -> if (v.buildType == "noR8" || v.buildType == "debug") { v.enable = false } } onVariants { v -> val artifactsLoader = v.artifacts.getBuiltArtifactsLoader() v.instrumentationRunnerArguments.put( "targetAppId", v.testedApks.map { artifactsLoader.load(it)?.applicationId } ) } }