build: android:apk build prod release

This commit is contained in:
Timi
2026-11-18 11:26:45 +08:00
parent 43a64acc12
commit 9ee957419f
7 changed files with 128 additions and 6 deletions
+9 -4
View File
@@ -45,10 +45,15 @@ grep versionCode android/app/build.gradle
写进 `dist` 和 `android/app/src/main/assets/public`,直接拿去打包就会打出一个连内网的正式包
- 打完核对:`aapt2 dump badging` 的 versionCode、`apksigner verify --print-certs` 的证书,
以及解包 grep 接口地址(内网地址必须为 0 次)
- 用 Android Studio 打包,**签名必须与线上包一致**:线上 1.0.0 用的是
`twa/android.keystore`(alias `gao-customer`,证书 `CN=yeyu` / SHA-256 `3E:9C:CC:8A:…`)。
签名不一致时系统会拒绝覆盖安装,老用户只能卸载重装
- `pnpm run android:apk` 走的是 `assembleDebug`,签的是本机 debug key,**不能用于发版**
- **一条命令出正式包**:`pnpm run android:apk`
= `android:sync:prod` + `assembleRelease` + 用 `twa/android.keystore` 签名 + 复制到
`android/app/release/app-release.apk`(已 gitignore),末尾会打印 versionCode、大小、
sha256 和证书指纹
- 签名凭证放在 `android/keystore.properties`(已 gitignore),格式见同目录
`keystore.properties.example`;缺密码时脚本会直接拦住,不会产出 debug 包
- 只重新打包、不重建 web:`pnpm run android:apk -- -SkipSync`
- 仍然可以用 Android Studio 打包,但**签名必须是 `twa/android.keystore`**
(alias `gao-customer`,`CN=yeyu` / SHA-256 `3E:9C:CC:8A:…`),否则系统拒绝覆盖安装
### 3. 提高 CI 的兼容基线