import com.android.build.api.dsl.ManagedVirtualDevice plugins { alias(libs.plugins.android.test) alias(libs.plugins.kotlin.android) alias(libs.plugins.baseline.profile) } android { compileSdk = libs.versions.androidCompileSdk.get().toInt() namespace = "com.artemchep.macrobenchmark" defaultConfig { minSdk = libs.versions.androidMinSdk.get().toInt() targetSdk = libs.versions.androidTargetSdk.get().toInt() testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } kotlinOptions { jvmTarget = "11" } testOptions.managedDevices.devices { maybeCreate("pixel6api34").apply { device = "Pixel 6" apiLevel = 34 systemImageSource = "google_apis_playstore" } } targetProjectPath = ":androidApp" // Enable the benchmark to run separately from the app process experimentalProperties["android.experimental.self-instrumenting"] = true buildTypes { // declare a build type to match the target app"s build type create("benchmark") { isDebuggable = true signingConfig = signingConfigs.getByName("debug") // Selects release buildType if the 'benchmark' // buildType not available in other modules. matchingFallbacks.add("release") } } buildFeatures { buildConfig = true } val accountManagementDimension = "accountManagement" flavorDimensions += accountManagementDimension productFlavors { maybeCreate("playStore").apply { dimension = accountManagementDimension } maybeCreate("none").apply { dimension = accountManagementDimension } } } baselineProfile { managedDevices += "pixel6api34" // This enables using connected devices to generate profiles. The default is true. // When using connected devices, they must be rooted or API 33 and higher. useConnectedDevices = false } dependencies { implementation(libs.androidx.benchmark.macro.junit4) implementation(libs.androidx.espresso.core) implementation(libs.androidx.junit) implementation(libs.androidx.uiautomator) implementation(libs.androidx.profileinstaller) }