1
+ plugins {
2
+ id(" com.android.test" )
3
+ id(" org.jetbrains.kotlin.android" )
4
+ }
5
+
6
+ android {
7
+ namespace = " cn.a10miaomiao.bilimiao.benchmark"
8
+ compileSdk = 33
9
+
10
+ compileOptions {
11
+ sourceCompatibility = JavaVersion .VERSION_1_8
12
+ targetCompatibility = JavaVersion .VERSION_1_8
13
+ }
14
+
15
+ kotlinOptions {
16
+ jvmTarget = " 1.8"
17
+ }
18
+
19
+ defaultConfig {
20
+ minSdk = 23
21
+ targetSdk = 33
22
+
23
+ testInstrumentationRunner = " androidx.test.runner.AndroidJUnitRunner"
24
+
25
+ // testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,DEBUGGABLE"
26
+ }
27
+
28
+ buildTypes {
29
+ // This benchmark buildType is used for benchmarking, and should function like your
30
+ // release build (for example, with minification on). It"s signed with a debug key
31
+ // for easy local/CI testing.
32
+ create(" benchmark" ) {
33
+ isDebuggable = true
34
+ signingConfig = getByName(" debug" ).signingConfig
35
+ matchingFallbacks + = listOf (" release" )
36
+ }
37
+ }
38
+
39
+ flavorDimensions + = listOf (" default" )
40
+ productFlavors {
41
+ create(" coolapk" ) { dimension = " default" }
42
+ create(" github" ) { dimension = " default" }
43
+ create(" gitee" ) { dimension = " default" }
44
+ create(" qq" ) { dimension = " default" }
45
+ create(" miao" ) { dimension = " default" }
46
+ }
47
+
48
+ targetProjectPath = " :app"
49
+ experimentalProperties[" android.experimental.self-instrumenting" ] = true
50
+ }
51
+
52
+ dependencies {
53
+ implementation(" androidx.test.ext:junit:1.1.5" )
54
+ implementation(" androidx.test.espresso:espresso-core:3.5.1" )
55
+ implementation(" androidx.test.uiautomator:uiautomator:2.2.0" )
56
+ implementation(" androidx.benchmark:benchmark-macro-junit4:1.1.1" )
57
+ }
58
+
59
+ androidComponents {
60
+ beforeVariants(selector().all()) {
61
+ it.enable = it.buildType == " benchmark"
62
+ }
63
+ }
0 commit comments