@@ -19,6 +19,7 @@ import io.getstream.Configurations
1919plugins {
2020 id(" com.android.test" )
2121 id(" org.jetbrains.kotlin.android" )
22+ id(libs.plugins.baseline.profile.get().pluginId)
2223}
2324
2425android {
@@ -30,12 +31,6 @@ android {
3031 targetCompatibility = JavaVersion .VERSION_11
3132 }
3233
33- defaultConfig {
34- minSdk = 24
35- targetSdk = Configurations .targetSdk
36- testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
37- }
38-
3934 buildTypes {
4035 // This benchmark buildType is used for benchmarking, and should function like your
4136 // release build (for example, with minification on). It"s signed with a debug key
@@ -47,8 +42,33 @@ android {
4742 }
4843 }
4944
45+ defaultConfig {
46+ minSdk = 24
47+ targetSdk = Configurations .targetSdk
48+ testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
49+ }
50+
5051 targetProjectPath = " :app"
51- experimentalProperties[" android.experimental.self-instrumenting" ] = true
52+ testOptions.managedDevices.devices {
53+ maybeCreate< com.android.build.api.dsl.ManagedVirtualDevice > (" pixel6api31" ).apply {
54+ device = " Pixel 6"
55+ apiLevel = 31
56+ systemImageSource = " aosp"
57+ }
58+ }
59+ }
60+
61+ // This is the plugin configuration. Everything is optional. Defaults are in the
62+ // comments. In this example, you use the GMD added earlier and disable connected devices.
63+ baselineProfile {
64+
65+ // This specifies the managed devices to use that you run the tests on. The default
66+ // is none.
67+ managedDevices + = " pixel6api31"
68+
69+ // This enables using connected devices to generate profiles. The default is true.
70+ // When using connected devices, they must be rooted or API 33 and higher.
71+ useConnectedDevices = false
5272}
5373
5474dependencies {
@@ -57,9 +77,3 @@ dependencies {
5777 implementation(libs.androidx.benchmark.macro)
5878 implementation(libs.androidx.profileinstaller)
5979}
60-
61- androidComponents {
62- beforeVariants(selector().all()) {
63- it.enable = it.buildType == " benchmark"
64- }
65- }
0 commit comments