AndroidStation(原中控改造为纯设备端) - 只做三件事:UDP 48899 被桌面端发现、TCP 8087 推送 USB 扫码结果、离线语音播报 - 扫码不再经过 UI:去掉逐键重绘,50ms 自动提交,同一码重复扫码也一律上报 - 离线语音种子(数字/字母/“开始打包”/欢迎语)随包安装,MediaPlayer 播放,启动把音量拉满 - 启动播报「欢迎使用溯源系统,初始化已经完成,扫码即可开始打包」 - 移除 Device Owner / 设备管理员 / lock task / 网络与 IP 设置等非普通应用能力(仅保留开机自启) - 正式签名 keystore + release 签名配置,versionName/versionCode 可由打包脚本覆盖 发布脚手架 - backend/android_client:Android 正式包构建(build.ps1 + package.config.json) - backend/scripts/deploy/publish-android.cjs + npm run android:build / android:publish - 桌面端安装包改为 download/desktop,Android 为 download/android_client; version.json 仍走 /download/version.json(老客户端写死),新增 /download/android_client/version.json - 谷歌插件随桌面端 MSI 安装到 <安装目录>\extension,工具菜单新增「复制谷歌插件地址」 - git-safety-check 增加仓库级禁区(keystore.properties / *.jks / local.properties) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
88 lines
3.1 KiB
Groovy
88 lines
3.1 KiB
Groovy
plugins {
|
||
id 'com.android.application'
|
||
}
|
||
|
||
// 正式签名:keystore.properties 不入库(见 .gitignore);没有它时 debug 构建不受影响,
|
||
// release 构建会退回 debug 签名,正式发布脚本会先检查这个文件。
|
||
def keystorePropertiesFile = rootProject.file('keystore.properties')
|
||
def keystoreProperties = new Properties()
|
||
if (keystorePropertiesFile.exists()) {
|
||
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||
}
|
||
|
||
// 发布脚本可以传 -PversionName=x.y.z -PversionCode=n 覆盖
|
||
def appVersionCode = (project.findProperty('versionCode') ?: '1').toString().toInteger()
|
||
def appVersionName = (project.findProperty('versionName') ?: '1.0.0').toString()
|
||
|
||
android {
|
||
namespace 'com.gztbyc.scancenter'
|
||
compileSdk 35
|
||
|
||
defaultConfig {
|
||
applicationId "com.gztbyc.scancenter"
|
||
minSdk 21
|
||
targetSdk 28
|
||
versionCode appVersionCode
|
||
versionName appVersionName
|
||
|
||
// 本工程是纯 Java,APK 内 lib/ 为空,与 CPU 架构无关(arm32/arm64/x86 通用),
|
||
// 因此这里不需要限制 ABI。
|
||
// 一旦引入带 .so 的依赖(如 ML Kit 条码识别或任何 native 库),请取消下面注释,
|
||
// 否则多套架构的库会被全部打进包内,包体成倍膨胀:
|
||
// ndk {
|
||
// abiFilters 'armeabi-v7a', 'arm64-v8a' // 排除 x86,只保留盒子/手机实际用到的架构
|
||
// }
|
||
}
|
||
|
||
signingConfigs {
|
||
release {
|
||
if (keystorePropertiesFile.exists()) {
|
||
storeFile rootProject.file(keystoreProperties['storeFile'])
|
||
storePassword keystoreProperties['storePassword']
|
||
keyAlias keystoreProperties['keyAlias']
|
||
keyPassword keystoreProperties['keyPassword']
|
||
}
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
debug {
|
||
minifyEnabled false
|
||
}
|
||
release {
|
||
minifyEnabled false
|
||
// 有正式 keystore 就用正式签名;没有时退回 debug,保证本地仍能 assembleRelease 验证
|
||
signingConfig keystorePropertiesFile.exists() ? signingConfigs.release : signingConfigs.debug
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
}
|
||
}
|
||
|
||
buildFeatures {
|
||
// util/L.java 依赖 BuildConfig.DEBUG 决定是否输出日志;AGP 8 起 buildConfig 默认关闭
|
||
buildConfig true
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_8
|
||
targetCompatibility JavaVersion.VERSION_1_8
|
||
encoding = 'UTF-8'
|
||
}
|
||
|
||
packaging {
|
||
resources {
|
||
excludes += ['META-INF/*.kotlin_module']
|
||
}
|
||
}
|
||
|
||
lint {
|
||
// targetSdk 28 是为在旧 TV 盒子上避开分区存储限制而刻意选择的,不发布 Google Play。
|
||
// lintVitalRelease 会因 ExpiredTargetSdkVersion 直接中断 release 构建,这里只关掉这一条,
|
||
// 其余 lint 检查保持开启。
|
||
disable 'ExpiredTargetSdkVersion'
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||
}
|