2024-11-26 22:47:37 +08:00
|
|
|
|
plugins {
|
|
|
|
|
id("com.android.application")
|
|
|
|
|
id("org.jetbrains.kotlin.android")
|
|
|
|
|
id("com.google.devtools.ksp")
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-27 09:48:10 +08:00
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
import java.util.Date
|
|
|
|
|
import com.android.build.api.variant.FilterConfiguration
|
|
|
|
|
|
2024-11-26 22:47:37 +08:00
|
|
|
|
android {
|
|
|
|
|
namespace = "com.yovinchen.bookkeeping"
|
|
|
|
|
compileSdk = 34
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
applicationId = "com.yovinchen.bookkeeping"
|
|
|
|
|
minSdk = 26
|
|
|
|
|
targetSdk = 34
|
|
|
|
|
versionCode = 1
|
2024-11-27 09:48:10 +08:00
|
|
|
|
versionName = "1.0.0"
|
2024-11-26 22:47:37 +08:00
|
|
|
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
|
vectorDrawables {
|
|
|
|
|
useSupportLibrary = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
|
release {
|
2024-11-27 09:48:10 +08:00
|
|
|
|
isMinifyEnabled = true
|
|
|
|
|
isShrinkResources = true
|
2024-11-26 22:47:37 +08:00
|
|
|
|
proguardFiles(
|
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
|
"proguard-rules.pro"
|
|
|
|
|
)
|
2024-11-27 09:48:10 +08:00
|
|
|
|
signingConfig = signingConfigs.getByName("debug") // 使用debug签名,实际发布时应该使用正式的签名配置
|
2024-11-26 22:47:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-11-27 09:48:10 +08:00
|
|
|
|
|
|
|
|
|
applicationVariants.all {
|
|
|
|
|
val variant = this
|
|
|
|
|
variant.outputs
|
|
|
|
|
.map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl }
|
|
|
|
|
.forEach { output ->
|
|
|
|
|
// 获取当前时间
|
|
|
|
|
val date = SimpleDateFormat("yyyyMMdd_HHmm").format(Date())
|
|
|
|
|
// 获取CPU架构,如果没有则使用universal
|
|
|
|
|
val buildType = variant.buildType.name
|
|
|
|
|
// 构建文件名
|
|
|
|
|
val outputFileName = "轻记账_${buildType}_v${variant.versionName}_${date}.apk"
|
|
|
|
|
output.outputFileName = outputFileName
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-26 22:47:37 +08:00
|
|
|
|
compileOptions {
|
2024-11-27 09:48:10 +08:00
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
2024-11-26 22:47:37 +08:00
|
|
|
|
}
|
|
|
|
|
kotlinOptions {
|
2024-11-27 09:48:10 +08:00
|
|
|
|
jvmTarget = "11"
|
2024-11-26 22:47:37 +08:00
|
|
|
|
}
|
|
|
|
|
buildFeatures {
|
|
|
|
|
compose = true
|
|
|
|
|
}
|
|
|
|
|
composeOptions {
|
|
|
|
|
kotlinCompilerExtensionVersion = "1.5.1"
|
|
|
|
|
}
|
|
|
|
|
packaging {
|
|
|
|
|
resources {
|
|
|
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation("androidx.core:core-ktx:1.12.0")
|
|
|
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
|
|
|
|
implementation("androidx.activity:activity-compose:1.8.2")
|
|
|
|
|
implementation(platform("androidx.compose:compose-bom:2024.02.00"))
|
|
|
|
|
implementation("androidx.compose.ui:ui")
|
|
|
|
|
implementation("androidx.compose.ui:ui-graphics")
|
|
|
|
|
implementation("androidx.compose.ui:ui-tooling-preview")
|
|
|
|
|
implementation("androidx.compose.material3:material3")
|
|
|
|
|
|
|
|
|
|
// ViewModel
|
|
|
|
|
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
|
|
|
|
|
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0")
|
|
|
|
|
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
|
|
|
|
|
implementation(libs.androidx.room.common)
|
|
|
|
|
implementation(libs.androidx.navigation.common.ktx)
|
|
|
|
|
implementation(libs.androidx.navigation.compose)
|
|
|
|
|
|
|
|
|
|
// Room
|
|
|
|
|
val roomVersion = "2.6.1"
|
|
|
|
|
implementation("androidx.room:room-runtime:$roomVersion")
|
|
|
|
|
implementation("androidx.room:room-ktx:$roomVersion")
|
|
|
|
|
ksp("androidx.room:room-compiler:$roomVersion")
|
|
|
|
|
|
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
|
|
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
|
|
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
|
|
|
|
androidTestImplementation(platform("androidx.compose:compose-bom:2024.02.00"))
|
|
|
|
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
|
|
|
|
debugImplementation("androidx.compose.ui:ui-tooling")
|
|
|
|
|
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
|
|
|
|
}
|