-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathandroid-app.gradle.kts
More file actions
111 lines (106 loc) · 3.59 KB
/
android-app.gradle.kts
File metadata and controls
111 lines (106 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import de.fayard.refreshVersions.core.versionFor
import java.io.FileNotFoundException
plugins {
kotlin("android")
id("com.android.application")
}
android {
compileSdk = 34
defaultConfig {
minSdk = 26
targetSdk = 33
resourceConfigurations += setOf("en", "fr")
}
// We embed the signing keystore to allow updating from another computer without uninstalling.
val debugSigningConfig by signingConfigs.creating {
storeFile = rootProject.file("debug.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
val keystoreFile = (findProperty("androidKeyFile") as String?)?.let { keyFilePath ->
File(System.getProperty("user.home")).resolve(keyFilePath).also {
if (it.exists().not()) throw FileNotFoundException("Didn't find keystore file at $it")
}
}
val releaseSigningConfig = keystoreFile?.let {
signingConfigs.create("releaseSigningConfig") {
val androidKeyFile: String by project
storeFile = File(System.getProperty("user.home")).resolve(androidKeyFile)
val androidKeyAlias: String by project
val androidKeyUniversalMdp: String by project
storePassword = androidKeyUniversalMdp
keyAlias = androidKeyAlias
keyPassword = androidKeyUniversalMdp
}
}
buildTypes {
debug {
applicationIdSuffix = ".debug"
signingConfig = debugSigningConfig
}
create("staging") {
applicationIdSuffix = ".staging"
matchingFallbacks += "release"
isMinifyEnabled = true
isShrinkResources = true
isDebuggable = false
signingConfig = debugSigningConfig
}
release {
isMinifyEnabled = true
isShrinkResources = true
signingConfig = releaseSigningConfig ?: debugSigningConfig
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
create("benchmark") {
initWith(buildTypes.getByName("release"))
matchingFallbacks += "release"
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-benchmark.pro"
)
}
}
kotlinOptions {
freeCompilerArgs += "-opt-in=splitties.experimental.ExperimentalSplittiesApi"
jvmTarget = "1.8"
freeCompilerArgs += "-Xcontext-receivers"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures.compose = true
composeOptions {
kotlinCompilerExtensionVersion = versionFor(AndroidX.compose.compiler)
}
packagingOptions.resources {
excludes += setOf(
"META-INF/ASL2.0",
"META-INF/AL2.0",
"META-INF/LGPL2.1",
"META-INF/LICENSE",
"META-INF/license.txt",
"META-INF/NOTICE",
"META-INF/notice.txt"
)
// Exclude files that unused kotlin-reflect would need, to make the app smaller:
// (see issue https://youtrack.jetbrains.com/issue/KT-9770)
excludes += setOf(
"META-INF/*.kotlin_module",
"kotlin/*.kotlin_builtins",
"kotlin/**/*.kotlin_builtins"
)
}
}
dependencies {
implementation {
AndroidX.activity.compose()
AndroidX.compose.runtime()
AndroidX.compose.foundation()
}
}