Files
jiecheng-business/app/build.gradle
freeboss b7b5518834 feat: dev-5.1 分支基线(v1.3.35 发版后代码 + 5.1 声道改造文档)
- 以 main(ccc65af) 为基线提交当前工作区代码
- 新增 5.1 声道改造文档两份
- .gitignore 补充 .vscode/、.screenshots/
2026-11-02 19:25:12 +08:00

362 lines
17 KiB
Groovy
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.devtools.ksp'
}
android {
namespace 'com.pukka.jiecheng'
compileSdk app_android.compileSdkVersion
buildFeatures {
buildConfig = true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
// 单元测试跑在 JVM 上,org.json 等 Android SDK 类默认抛 "not mocked";
// voice/parser(SkyworthVodParser 等)依赖 org.json 解析 payload,
// 需要真实实现。这里引入官方 json.org 的 JVM 版本(仅 test classpath)。
testOptions {
unitTests {
includeAndroidResources = true
}
}
def versionSuffix = "0" // 定义版本后缀变量,必须小于或等于9大于0
defaultConfig {
applicationId "tv.huashi.jetsenx.jetsenfilx.jsttv"
minSdk app_android.minSdkVersion
targetSdk app_android.targetSdkVersion
versionCode Integer.parseInt(new Date().format("yyMMddHH") + versionSuffix)
versionName "v1.3.35"
multiDexEnabled true
//压缩语言种类,目前只支持中文语言
resConfigs('zh-rCN')
// Define flavor dimensions
flavorDimensions "channel", "control"
// ===== 语音协议占位符默认值(文档 §6.2 signature-level permission) =====
// debug 通过 flavor 覆盖为 normal 方便联调,release 维持 signature。
manifestPlaceholders = [voiceProtectionLevel: "signature"]
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//酒店 ANNING 安柠 AISHI 爱视(不要手柄)
buildConfigField "String", "HOTEL_TYPE", "\"AISHI\""
//首页是否包含我的页面 默认是包含 true,去掉 false 当前只有特殊爱视酒店版本不包含
buildConfigField "boolean", "NEED_MY", "true"
//是否需要激活码 扫码版下 as8Code 覆盖为 false
buildConfigField "boolean", "NEED_ACTIVATION_CODE", "true"
//是否为扫码变体(as8Scan 覆盖为 true;asAScan 同样覆盖为 true)
buildConfigField "boolean", "SCAN_VARIANT", "false"
//是否为家用版(home flavor 覆盖为 true)
buildConfigField "boolean", "IS_HOME_EDITION", "false"
//默认激活码:扫码变体在 NEED_ACTIVATION_CODE=false 时使用,普通渠道为空字符串
buildConfigField "String", "DEFAULT_ACTIVATION_CODE", "\"\""
buildConfigField "String", "BUGLY_APP_ID", "\"01f1b10fca\""
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
signingConfigs {
release {
storeFile file('key/jiecheng.jks')
storePassword 'abc@123'
keyAlias 'key0'
keyPassword 'abc@123'
}
preview {
storeFile file('key/jiecheng.jks')
storePassword 'abc@123'
keyAlias 'key0'
keyPassword 'abc@123'
}
}
buildTypes {
release {
// AS 域 baseUrl:release 走线上域名
buildConfigField "String", "AS_BASE_URL", "\"https://jst.ainetv.cn/api/\""
//是否开启混淆
minifyEnabled false
shrinkResources false
zipAlignEnabled true // 是否开启zip压缩
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// release 严格按文档 §6.2 使用 signature-level permission
manifestPlaceholders = [voiceProtectionLevel: "signature"]
}
// preview {
// // AS 域 baseUrl:preview 走预发域名
// buildConfigField "String", "AS_BASE_URL", "\"https://jst-test.ainetv.cn/api/\""
// minifyEnabled false
// shrinkResources false
// zipAlignEnabled true // 是否开启zip压缩
// signingConfig signingConfigs.release
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
//// matchingFallbacks = ['release', 'debug']
// }
debug {
// AS 域 baseUrl:debug 走测试/内网域名
buildConfigField "String", "AS_BASE_URL", "\"http://as-partner-end.172.16.100.105.sslip.io/\"" //http://as-partner-end.172.16.100.105.sslip.io/
minifyEnabled false
shrinkResources false
zipAlignEnabled true // 是否开启zip压缩
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// 联调期间把 voice 协议自定义 permission 降级为 normal,让 adb shell 可投递(release 仍走 signature)。
manifestPlaceholders = [voiceProtectionLevel: "normal"]
}
}
// Configure product flavors
productFlavors {
// --- Dimension: Control (Interaction Mode) ---
touch {
dimension "control"
buildConfigField "boolean", "IS_TOUCH_MODE", "true"
}
remote {
dimension "control"
buildConfigField "boolean", "IS_TOUCH_MODE", "false"
}
// --- Dimension: Channel ---
// Default base channel (Aishi)
aishi {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "aishi",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"AS\""
}
ruigeer {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "ruigeer",
splash_theme : "@style/SplashTheme"]
//隐藏我的页面
buildConfigField "boolean", "NEED_MY", "false"
buildConfigField "String", "CHANNEL_ID", "\"RG\""
}
ceshi {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "ceshi",
splash_theme : "@style/SplashTheme"]
//隐藏我的页面
// buildConfigField "boolean", "NEED_MY", "false"
buildConfigField "String", "CHANNEL_ID", "\"TS\""
}
// --- aishi 子方向:扫码版(无激活码 默认 88888 的激活码) ---
// 共享 aishi 渠道路由(X-Channel-Id="AS"),仅客户端激活流程差异
as8Scan {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "as8Scan",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"AS\""
buildConfigField "boolean", "NEED_ACTIVATION_CODE", "false"
buildConfigField "boolean", "SCAN_VARIANT", "true"
buildConfigField "String", "DEFAULT_ACTIVATION_CODE", "\"88888\""
}
// --- 声立方:扫码版(无激活码 默认 UK4KQ 的激活码) ---
fxScan {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "fxScan",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"FX\""
buildConfigField "boolean", "NEED_ACTIVATION_CODE", "false"
buildConfigField "boolean", "SCAN_VARIANT", "true"
buildConfigField "String", "DEFAULT_ACTIVATION_CODE", "\"UK4KQ\""
}
// --- aishi 子方向:激活扫码版(有激活码) ---
// 保留 NEED_ACTIVATION_CODE=true(年卡业务默认值),但额外打 SCAN_VARIANT=true:
// /api/jst/check 在「已激活 无权益码」分支可能不返回 10900,而是其他 Activated 等价 code,
// 此时 thirdCardNo 为空属于合法终态,不应弹"缺少设备码"。
asAScan {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "asAScan",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"AS\""
buildConfigField "boolean", "SCAN_VARIANT", "true"
}
// 测试渠道分销
qnAScan {
dimension "channel"
manifestPlaceholders = [
APP_CHANNEL_ID : "qnAScan",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"QN\""
buildConfigField "boolean", "SCAN_VARIANT", "true"
}
// --- 家用版:独立 applicationId,与商用渠道并行发行 ---
// 暂与商用版共用 BUGLY_APP_ID / versionCode(家用版需独立时再覆盖)。
// 未来若需按地区/子渠道拆分,加为 sibling flavor 并各自挂 applicationIdSuffix 即可。
//
// CHANNEL_ID="HM":与 CLAUDE.md 渠道表一致,且避免与 fxScan("FX") 在 X-Channel-ID 头冲突
// (OkHttpClientUtil + HttpRequestInterceptor 注入该头,相同 CHANNEL_ID 会让后端把家用版路由为声立方扫码版)。
// SCAN_VARIANT=true + DEFAULT_ACTIVATION_CODE="UK4KQ":保持与 as8Scan/fxScan 同款的"扫码 + 静默激活"语义,
// 配合 tryAutoActivateWithDefaultCode 在 MainActivity 静默激活家用版设备。
// 若后续家用版切换为需要激活码输入面板,可将 NEED_ACTIVATION_CODE 改回 true 并清空 DEFAULT_ACTIVATION_CODE。
home {
dimension "channel"
applicationIdSuffix ".home"
manifestPlaceholders = [
APP_CHANNEL_ID : "home",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"FX\""
buildConfigField "String", "HOTEL_TYPE", "\"HOME\""
buildConfigField "boolean", "IS_HOME_EDITION", "true"
buildConfigField "boolean", "NEED_ACTIVATION_CODE", "false"
buildConfigField "boolean", "SCAN_VARIANT", "false"
buildConfigField "String", "DEFAULT_ACTIVATION_CODE", "\"UK4KQ\""
}
ashome {
dimension "channel"
applicationIdSuffix ".home"
manifestPlaceholders = [
APP_CHANNEL_ID : "home",
splash_theme : "@style/SplashTheme"]
buildConfigField "String", "CHANNEL_ID", "\"AS\""
buildConfigField "String", "HOTEL_TYPE", "\"HOME\""
buildConfigField "boolean", "IS_HOME_EDITION", "true"
buildConfigField "boolean", "NEED_ACTIVATION_CODE", "false"
buildConfigField "boolean", "SCAN_VARIANT", "false"
buildConfigField "String", "DEFAULT_ACTIVATION_CODE", "\"88888\""
}
// Add more channels to this list as needed
// def channelList = ["q1"]
// channelList.each { name ->
// create(name) {
// dimension "channel"
// manifestPlaceholders = [
// APP_CHANNEL_ID : name,
// splash_theme : "@style/SplashTheme"]
// }
// }
}
android.applicationVariants.all {
variant ->
variant.outputs.all {
output ->
if (outputFileName != null && outputFileName.contains('.apk')) {
def datetime = String.valueOf(new Date().format("yyyyMMddHHmm"))
// Naming format: Jetsenx_APK_<BuildType>_<Flavor>_<Date>.apk
//outputFileName = "Jetsenx_APK_${variant.buildType.name}_${variant.name}_${datetime}.apk"
outputFileName = "Jetsenx_${variant.versionName}_${variant.name}_${variant.versionCode}.apk"
}
}
}
compileOptions {
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
// Standard Gradle directory structure is used:
// src/main/res -> Common resources
// src/aishi/res -> Aishi channel resources
// src/q1/res -> Q1 channel resources
// src/touch/res -> Touch mode resources
// src/remote/res -> Remote mode resources
}
}
dependencies {
app_base_dependencies.each { k, v -> implementation v }
app_app_dependencies.each { k, v -> implementation v }
app_base_android_test_dependencies.each { k, v -> androidTestImplementation v }
app_base_test_dependencies.each { k, v -> testImplementation v }
implementation 'com.bytedance.boost_multidex:boost_multidex:1.0.1'
implementation project(':libcore')
implementation project(':libdata')
implementation project(':mediaplayertv')
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.zxing:core:3.2.1'
// debugImplementation files('libs/JetsenxSdk-external-release_v1.14.0.aar')
// previewImplementation files('libs/JetsenxSdk-external-release_v1.14.0.aar')
// releaseImplementation files('libs/JetsenxSdk-api-release_v1.14.0.aar')
debugImplementation files('libs/JetsenxSdk-api-future-release-v1.23.aar')
// previewImplementation files('libs/JetsenxSdk-api-future-release-v1.23.aar')
releaseImplementation files('libs/JetsenxSdk-api-future-release-v1.23.aar')
implementation files('libs/NewTVSDK-v4.0.3-app-lite.jar')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.exoplayer:exoplayer:2.19.1'
// 5.1声道兜底(AC3/EAC3/DTS/TrueHD),配合 PkExoMediaPlayer 的 EXTENSION_RENDERER_MODE_ON:
// 平台渲染器优先(支持AC3直通/HW解码的设备走平台),FFmpeg仅在平台不支持时兜底软解为PCM
implementation files('libs/exoplayer-ffmpeg-extension-2.19.1.aar')
// implementation 'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.8.3'
implementation 'commons-codec:commons-codec:1.15'
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.github.gzu-liyujiang:Android_CN_OAID:4.1.3'
implementation('io.github.volcengine-tls:tls-android-producer:2.0.2-api16') {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.google.guava', module: 'guava-jdk5'
exclude group: 'com.google.guava', module: 'guava-android'
exclude group: 'com.google.guava', module: 'listenablefuture'
}
// 强制使用统一的 Guava 版本
implementation 'com.google.guava:guava:31.1-android'
// ===== 网络层(脚手架新引入,与既有 HttpUtils 双栈共存) =====
// 为什么显式指定版本:app 模块此前未声明 retrofit/okhttp/moshi/coroutines,避免被根 config.gradle 隐式拉入不同版本。
// Kotlin 1.9.22 -> KSP 1.9.22-1.0.17 已对齐。
// 为什么用 `platform(enforcedPlatform)` 而非 `implementation`:okhttp-bom 是 Bill-of-Materials,本身仅提供版本对齐,
// 不能被当作运行时产物拉到 runtime classpath(这正是上一个编译报错的根因)。
implementation platform('com.squareup.okhttp3:okhttp-bom:4.12.0')
implementation 'com.squareup.retrofit2:retrofit:2.11.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.11.0'
implementation 'com.squareup.okhttp3:okhttp'
implementation 'com.squareup.okhttp3:logging-interceptor'
implementation 'com.squareup.moshi:moshi:1.15.1'
implementation 'com.squareup.moshi:moshi-kotlin:1.15.1'
ksp 'com.squareup.moshi:moshi-kotlin-codegen:1.15.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation 'net.jpountz.lz4:lz4:1.3.0'
implementation 'org.slf4j:slf4j-android:1.7.36'
//腾讯buggly
implementation 'com.tencent.bugly:crashreport:latest.release'
//爱奇艺本地奔溃日志
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.1.0'
// org.json 的 JVM 实现:Android SDK 自带的 org.json 在本地单测里是空壳(not mocked),
// 供 voice/parser 下基于 JSONObject 的解析逻辑做真实单测。
testImplementation 'org.json:json:20180813'
}