Add release build configuration with automatic signing

- Configure release build type with minify and shrink resources
- Add signing configuration using keystore
- Use gradle.properties for secure password storage
- Add keystore to .gitignore for security
This commit is contained in:
2026-03-15 21:47:31 +08:00
parent ffb6677cfd
commit 4415f28d08
3 changed files with 19 additions and 1 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@ NUL
# Android/ Gradle build outputs (optional for CI, can be kept locally if desired)
**/build/
.gradle/
app/my-release.jks

View File

@@ -20,13 +20,24 @@ android {
}
}
signingConfigs {
create("release") {
storeFile = file(project.properties["RELEASE_STORE_FILE"] as String? ?: "my-release.jks")
storePassword = project.properties["RELEASE_STORE_PASSWORD"] as String? ?: "android123"
keyAlias = project.properties["RELEASE_KEY_ALIAS"] as String? ?: "my-key"
keyPassword = project.properties["RELEASE_KEY_PASSWORD"] as String? ?: "android123"
}
}
buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
}
}
compileOptions {

View File

@@ -3,3 +3,9 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
# Signing configuration
RELEASE_STORE_PASSWORD=android123
RELEASE_KEY_PASSWORD=android123
RELEASE_KEY_ALIAS=my-key
RELEASE_STORE_FILE=my-release.jks