304 lines
13 KiB
Groovy
304 lines
13 KiB
Groovy
|
|
import com.android.build.api.variant.BuildConfigField
|
|||
|
|
|
|||
|
|
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
|
|||
|
|
}
|
|||
|
|
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.28"
|
|||
|
|
multiDexEnabled true
|
|||
|
|
//压缩语言种类,目前只支持中文语言
|
|||
|
|
resConfigs('zh-rCN')
|
|||
|
|
|
|||
|
|
// Define flavor dimensions
|
|||
|
|
flavorDimensions "channel", "control"
|
|||
|
|
|
|||
|
|
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"
|
|||
|
|
buildConfigField "String", "BUGLY_APP_ID", "\"01f1b10fca\""
|
|||
|
|
//是否为第三方变体(thirdparty flavor 覆盖为 true)
|
|||
|
|
buildConfigField "boolean", "THIRDPARTY_VARIANT", "false"
|
|||
|
|
|
|||
|
|
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'
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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", "\"https://jst-test.ainetv.cn/api/\"" //http://as-partner-end.172.16.100.110.sslip.io/
|
|||
|
|
minifyEnabled false
|
|||
|
|
shrinkResources false
|
|||
|
|
zipAlignEnabled true // 是否开启zip压缩
|
|||
|
|
signingConfig signingConfigs.release
|
|||
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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 子方向:扫码版(无激活码 默认 8888 的激活码) ---
|
|||
|
|
// 共享 aishi 渠道路由(X-Channel-Id="AS"),仅客户端激活流程差异
|
|||
|
|
as8Scan {
|
|||
|
|
dimension "channel"
|
|||
|
|
manifestPlaceholders = [
|
|||
|
|
APP_CHANNEL_ID : "aishi",
|
|||
|
|
splash_theme : "@style/SplashTheme"]
|
|||
|
|
buildConfigField "String", "CHANNEL_ID", "\"AS\""
|
|||
|
|
buildConfigField "boolean", "NEED_ACTIVATION_CODE", "false"
|
|||
|
|
buildConfigField "boolean", "SCAN_VARIANT", "true"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// --- aishi 子方向:激活扫码版(有激活码) ---
|
|||
|
|
// 保留 NEED_ACTIVATION_CODE=true(年卡业务默认值),但额外打 SCAN_VARIANT=true:
|
|||
|
|
// /api/jst/check 在「已激活 无权益码」分支可能不返回 10900,而是其他 Activated 等价 code,
|
|||
|
|
// 此时 thirdCardNo 为空属于合法终态,不应弹"缺少设备码"。
|
|||
|
|
asAScan {
|
|||
|
|
dimension "channel"
|
|||
|
|
manifestPlaceholders = [
|
|||
|
|
APP_CHANNEL_ID : "aishi",
|
|||
|
|
splash_theme : "@style/SplashTheme"]
|
|||
|
|
buildConfigField "String", "CHANNEL_ID", "\"AS\""
|
|||
|
|
buildConfigField "boolean", "SCAN_VARIANT", "true"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// --- 第三方渠道(thirdparty) ---
|
|||
|
|
thirdparty {
|
|||
|
|
dimension "channel"
|
|||
|
|
applicationIdSuffix ".thirdparty"
|
|||
|
|
manifestPlaceholders = [
|
|||
|
|
APP_CHANNEL_ID : "thirdparty",
|
|||
|
|
splash_theme : "@style/SplashTheme"]
|
|||
|
|
buildConfigField "String", "CHANNEL_ID", "\"TP\""
|
|||
|
|
buildConfigField "boolean", "THIRDPARTY_VARIANT", "true"
|
|||
|
|
// 注意:AS_BASE_URL 不能在此处覆盖,buildType 的 buildConfigField 优先级更高会将其覆盖。
|
|||
|
|
// 第三方域名通过下方 androidComponents.onVariants 设置(Variant API 优先级最高)。
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 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
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 第三方变体 AS_BASE_URL 覆盖:
|
|||
|
|
// buildType 的 buildConfigField 优先级高于 flavor,因此 thirdparty flavor 内直接设置会被
|
|||
|
|
// debug/release buildType 覆盖为 jst-test/jst.ainetv.cn。Variant API 的优先级最高,在此统一覆盖。
|
|||
|
|
androidComponents {
|
|||
|
|
onVariants(selector().withFlavor("channel", "thirdparty")) { variant ->
|
|||
|
|
variant.buildConfigFields.put(
|
|||
|
|
"AS_BASE_URL",
|
|||
|
|
new BuildConfigField("String", "\"http://58.220.83.58:8084/\"", null)
|
|||
|
|
)
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
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'
|
|||
|
|
//implementation(name: 'exoplayer-ffmpeg-extension-2.19.1', ext: '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'
|
|||
|
|
}
|