115 lines
4.0 KiB
Plaintext
115 lines
4.0 KiB
Plaintext
plugins {
|
||
id("com.android.application")
|
||
id("org.jetbrains.kotlin.android")
|
||
id("com.google.devtools.ksp")
|
||
}
|
||
|
||
import java.text.SimpleDateFormat
|
||
import java.util.Date
|
||
import com.android.build.api.variant.FilterConfiguration
|
||
|
||
android {
|
||
namespace = "com.yovinchen.bookkeeping"
|
||
compileSdk = 34
|
||
|
||
defaultConfig {
|
||
applicationId = "com.yovinchen.bookkeeping"
|
||
minSdk = 26
|
||
targetSdk = 34
|
||
versionCode = 6
|
||
versionName = "1.3.0"
|
||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||
vectorDrawables {
|
||
useSupportLibrary = true
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
isMinifyEnabled = true
|
||
isShrinkResources = true
|
||
proguardFiles(
|
||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||
"proguard-rules.pro"
|
||
)
|
||
signingConfig = signingConfigs.getByName("debug") // 使用debug签名,实际发布时应该使用正式的签名配置
|
||
}
|
||
}
|
||
|
||
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
|
||
}
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility = JavaVersion.VERSION_11
|
||
targetCompatibility = JavaVersion.VERSION_11
|
||
}
|
||
kotlinOptions {
|
||
jvmTarget = "11"
|
||
}
|
||
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)
|
||
implementation(libs.vision.internal.vkp)
|
||
|
||
// Room
|
||
val roomVersion = "2.6.1"
|
||
implementation("androidx.room:room-runtime:$roomVersion")
|
||
implementation("androidx.room:room-ktx:$roomVersion")
|
||
ksp("androidx.room:room-compiler:$roomVersion")
|
||
|
||
// 图表库
|
||
implementation("com.github.PhilJay:MPAndroidChart:v3.1.0")
|
||
implementation("androidx.compose.material:material-icons-extended:1.4.3")
|
||
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")
|
||
|
||
// CSV Excel 库
|
||
implementation("com.opencsv:opencsv:5.7.1")
|
||
implementation("org.apache.poi:poi:5.2.3")
|
||
implementation("org.apache.poi:poi-ooxml:5.2.3")
|
||
} |