build(android): release signing config — key.properties based, debug fallback
正式签名(CN=PhotoLive):keystore/key.properties 不入库(gitignore 已覆盖); 无配置的构建机回退 debug 签名。首个正式签名 APK 已产出并 apksigner 验证。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import java.util.Properties
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
@@ -25,11 +26,26 @@ android {
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
// 正式签名(key.properties + photo-live-release.jks,均不入库):
|
||||
// 缺失时回退 debug 签名(CI/他人克隆仓库仍可构建)。
|
||||
val keystoreProps = Properties().apply {
|
||||
val f = rootProject.file("app/key.properties")
|
||||
if (f.exists()) f.inputStream().use { load(it) }
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
signingConfig = if (keystoreProps.getProperty("storeFile") != null) {
|
||||
signingConfigs.create("release") {
|
||||
storeFile = rootProject.file("app/" + keystoreProps.getProperty("storeFile"))
|
||||
storePassword = keystoreProps.getProperty("storePassword")
|
||||
keyAlias = keystoreProps.getProperty("keyAlias")
|
||||
keyPassword = keystoreProps.getProperty("keyPassword")
|
||||
}
|
||||
} else {
|
||||
// Signing with the debug keys(无正式签名配置的构建机回退)。
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
// R8 混淆会破坏 WorkManager 反射初始化(NoSuchMethodException
|
||||
// WorkDatabase_Impl),ProGuard keep 规则见 proguard-rules.pro。
|
||||
isMinifyEnabled = true
|
||||
|
||||
Reference in New Issue
Block a user