feat: 添加 Android 构建脚本以简化版本管理

- 新增 Makefile,提供构建、清理和安装命令,支持指定版本号和版本代码。
- 更新 build.gradle.kts,支持从命令行参数读取版本号和版本代码,增强构建灵活性。
This commit is contained in:
penghanyuan
2026-02-14 10:44:56 +01:00
parent aa20ce3039
commit df91719a2f
2 changed files with 77 additions and 2 deletions

View File

@@ -9,6 +9,10 @@ plugins {
alias(libs.plugins.ksp)
}
// 版本号配置(支持从命令行参数读取)
val appVersionName: String = project.findProperty("versionName")?.toString() ?: "1.0.0"
val appVersionCode: Int = (project.findProperty("versionCode")?.toString() ?: "1").toInt()
// 加载签名配置(从 keystore.properties 文件读取)
val keystorePropertiesFile = rootProject.file("keystore.properties")
val keystoreProperties = Properties()
@@ -24,8 +28,8 @@ android {
applicationId = "com.huaga.life_echo"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0.0"
versionCode = appVersionCode
versionName = appVersionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}