114 lines
4.1 KiB
Groovy
114 lines
4.1 KiB
Groovy
plugins {
|
|
id "com.android.application"
|
|
id "org.jetbrains.kotlin.android"
|
|
}
|
|
|
|
// ⚠️ 本机 /tmp 是 5.6G 的 tmpfs,且常被"已删除但仍被打开"的文件占满 ——
|
|
// 单测写临时文件时会直接抛 IOException: 超出磁盘配额(EDQUOT),看起来像测试失败。
|
|
// 统一把测试 JVM 的临时目录指到项目所在磁盘(/home 有 400G 空闲),与 /tmp 状态解耦。
|
|
tasks.withType(Test).configureEach {
|
|
def testTmp = new File(rootDir, 'build/test-tmp')
|
|
doFirst { testTmp.mkdirs() }
|
|
systemProperty 'java.io.tmpdir', testTmp.absolutePath
|
|
}
|
|
|
|
android {
|
|
namespace "com.local.ktv"
|
|
compileSdk 35
|
|
|
|
defaultConfig {
|
|
applicationId "com.local.ktv"
|
|
minSdk 21
|
|
targetSdk 25
|
|
versionCode 43
|
|
versionName "1.6.0"
|
|
ndk {
|
|
// 双 ABI 打包:兼容 64 位(Exynos 1580 等 arm64-v8a)与 32 位设备(极米 Play 超越版
|
|
// 的 Amlogic 950X2/S905X2 采用 32 位 Android 用户态,必须包含 armeabi-v7a,否则
|
|
// 会出现 INSTALL_FAILED_NO_MATCHING_ABIS 安装失败)。
|
|
// Package each ABI's complete IJK set; never mix individual SOs across the two sets.
|
|
abiFilters "armeabi-v7a", "arm64-v8a"
|
|
}
|
|
// 曲库已改为官方 Muse 同步(database_publish 不再发布到 Gitee),
|
|
// 不再需要 GITEE_DATABASE_* 构建参数。
|
|
}
|
|
|
|
// 签名配置:使用已有的 ktv_keystore.jks
|
|
signingConfigs {
|
|
release {
|
|
storeFile file("../../ktv_keystore.jks")
|
|
storePassword "123456"
|
|
keyAlias "ktv"
|
|
keyPassword "123456"
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
signingConfig signingConfigs.release
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
}
|
|
debug {
|
|
debuggable true
|
|
applicationIdSuffix ".qa"
|
|
}
|
|
}
|
|
|
|
// 支持 .ts 视频文件(aapt 不压缩这些文件以避免 SoundPool/MediaPlayer 问题)
|
|
androidResources {
|
|
noCompress 'ts', 'mp3', 'mp4', 'aac', 'm4a', 'flac', 'wav'
|
|
}
|
|
|
|
// lint 策略:
|
|
// - 「调用了高于 minSdk 且未做版本守卫的 API」(NewApi) 必须**阻断发布构建**:
|
|
// 这类问题在 Android 5.x / 6.x 上直接 NoSuchMethodError / NoClassDefFoundError 闪退,
|
|
// 而本地打包测试用的都是较新设备, 极容易漏出去(v1.4.0 在极米 H1S / Android 5.1.1
|
|
// 一打开就闪退, 根因就是 AudioDeviceCallback(API 23) 被写进了 Activity 的字段初始化器)。
|
|
// - ExpiredTargetSdkVersion 默认也是 fatal 级, 但本地分发的 APK 不上架 Google Play,
|
|
// 显式关掉, 否则会挤占下面这道闸门。
|
|
// - abortOnError 必须为 true: 设为 false 会把 lintVital 的失败一并吞掉, 闸门会失效。
|
|
lint {
|
|
fatal += ['NewApi']
|
|
disable += ['ExpiredTargetSdkVersion']
|
|
checkReleaseBuilds true
|
|
abortOnError true
|
|
}
|
|
|
|
// 启用 BuildConfig 生成,供 AboutFragment 读取版本号/版本Code等信息
|
|
buildFeatures {
|
|
buildConfig = true
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
}
|
|
|
|
// 强制统一 Kotlin 标准库版本,避免 appcompat 与其他依赖的版本冲突
|
|
configurations.all {
|
|
resolutionStrategy {
|
|
force "org.jetbrains.kotlin:kotlin-stdlib:1.8.22"
|
|
force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22"
|
|
force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22"
|
|
force "org.jetbrains.kotlin:kotlin-stdlib-common:1.8.22"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation files('libs/original-ijk-runtime.jar')
|
|
implementation "androidx.core:core:1.12.0"
|
|
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
implementation "com.google.zxing:core:3.5.3"
|
|
implementation "com.liulishuo.okdownload:okdownload:1.0.7"
|
|
testImplementation "junit:junit:4.13.2"
|
|
|
|
}
|