[new] new project
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
# 构建与发布
|
||||
|
||||
## 1. 版本
|
||||
|
||||
定义在 `app/build.gradle.kts`:
|
||||
|
||||
```kotlin
|
||||
versionCode = 1
|
||||
versionName = "1.0.0"
|
||||
applicationId = "com.starschedule"
|
||||
namespace = "com.xingheyuzhuan.shiguangschedule"
|
||||
```
|
||||
|
||||
升版本时两处一起改。`versionCode` 必须递增才能覆盖安装。
|
||||
|
||||
## 2. 常用命令
|
||||
|
||||
在 `starschedule/` 目录:
|
||||
|
||||
```bat
|
||||
gradlew.bat :app:assembleDebug
|
||||
gradlew.bat :app:assembleRelease
|
||||
gradlew.bat :app:installDebug
|
||||
```
|
||||
|
||||
Debug / Release APK 文件名:
|
||||
|
||||
```
|
||||
starschedule-v{versionName}-{abi}-{buildType}.apk
|
||||
```
|
||||
|
||||
ABI:`armeabi-v7a`、`arm64-v8a`、`x86_64`。未打 universal 包。
|
||||
|
||||
输出目录:`app/build/outputs/apk/<buildType>/`。
|
||||
|
||||
## 3. 镜像
|
||||
|
||||
`settings.gradle.kts`:
|
||||
|
||||
1. 腾讯云 `https://mirrors.cloud.tencent.com/nexus/repository/maven-public/`(优先)
|
||||
2. `google()`(仅 androidx / com.android / com.google)
|
||||
3. `mavenCentral()`
|
||||
4. 插件仓库额外还有 `gradlePluginPortal()`
|
||||
|
||||
`gradle/wrapper/gradle-wrapper.properties`:
|
||||
|
||||
```
|
||||
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-9.7.1-bin.zip
|
||||
```
|
||||
|
||||
模块内禁止再声明仓库(`FAIL_ON_PROJECT_REPOS`)。
|
||||
|
||||
## 4. 关键 Gradle 开关
|
||||
|
||||
`gradle.properties`:
|
||||
|
||||
- 配置缓存、构建缓存、并行
|
||||
- JVM 堆 4096M
|
||||
- `android.nonTransitiveRClass=true`
|
||||
- `kotlin.native.ignoreDisabledTargets=true`(即使当前无 native 目标也无妨)
|
||||
|
||||
`app`:
|
||||
|
||||
- `localeFilters`: `zh`, `zh-rCN`
|
||||
- `generateLocaleConfig = false`
|
||||
- Release:minify + shrinkResources,当前 `signingConfig` 暂用 debug 签名,**正式上架前必须换成正式 keystore**。
|
||||
|
||||
## 5. 依赖版本目录
|
||||
|
||||
统一写在 `gradle/libs.versions.toml`。不要在子模块写死版本号。
|
||||
|
||||
主要库(版本以 `libs.versions.toml` 为准):Compose Multiplatform 1.11.1、Material 3、Navigation3、Room 3.0.1、DataStore 1.2.1、Koin 4.2.2、Ktor 3.5.2、Wire 6.4.5、Okio、Coil 3、kotlinx-serialization / datetime、WorkManager 2.11.2。
|
||||
|
||||
## 6. ProGuard
|
||||
|
||||
Release 开启混淆。`app/proguard-rules.pro` 已 keep:
|
||||
|
||||
- Koin 模块、`@Single` / `@Factory` / `@KoinViewModel` 构造
|
||||
- `ListenableWorker` 子类、`AppWidgetProvider`
|
||||
- Kotlinx Serialization、Wire
|
||||
- `data.db`、`data.model`、`shared` 命名空间下部分类
|
||||
|
||||
WebView 的 `NativeBridge.postMessage`(`@JavascriptInterface`)包名不在上述 keep 前缀里。打正式包后必须真机验证正方导入;若 JS 调不通,在 ProGuard 中 keep `@JavascriptInterface` 方法。修改 Bridge 或序列化模型后用 `assembleRelease` 再跑:正方导入、JSON 往返、ZIP 恢复。
|
||||
|
||||
## 7. 发布检查清单
|
||||
|
||||
- [ ] versionName / versionCode 已升
|
||||
- [ ] 使用正式签名而非 debug
|
||||
- [ ] `assembleRelease` 三个 ABI 均成功
|
||||
- [ ] 冷启动、导入正方、JSON 往返、ZIP 恢复、提醒、四种小组件
|
||||
- [ ] 无英文界面入口
|
||||
- [ ] 隐私:不采集账号;网络权限仅网页、WebDAV、节假日
|
||||
|
||||
## 8. 许可证
|
||||
|
||||
根目录 `LICENSE` 为 Apache 2.0,版权声明沿用原项目 XingHeYuZhuan。对外分发时保留许可证与 NOTICE 要求。
|
||||
Reference in New Issue
Block a user