2026-09-23 17:15:51 +08:00
|
|
|
|
import java.util.Properties
|
2026-09-19 00:22:04 +08:00
|
|
|
|
plugins {
|
|
|
|
|
|
id("com.android.application")
|
|
|
|
|
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
|
|
|
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
|
namespace = "com.photolive.photo_live"
|
|
|
|
|
|
compileSdk = flutter.compileSdkVersion
|
|
|
|
|
|
ndkVersion = flutter.ndkVersion
|
|
|
|
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
|
applicationId = "com.photolive.photo_live"
|
|
|
|
|
|
// P3 约定:minSdk 24(Flutter 默认下限);targetSdk 36(Android 16)。
|
|
|
|
|
|
// Task 7 原生桥接:targetSdk>=34 走 WorkManager expedited + dataSync 前台服务;
|
|
|
|
|
|
// 若需降级(厂商兼容),路径 = 普通 WorkManager + 前台服务通知(见技术方案 §6.3)。
|
|
|
|
|
|
minSdk = 24
|
|
|
|
|
|
targetSdk = 36
|
|
|
|
|
|
versionCode = flutter.versionCode
|
|
|
|
|
|
versionName = flutter.versionName
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-23 17:15:51 +08:00
|
|
|
|
// 正式签名(key.properties + photo-live-release.jks,均不入库):
|
|
|
|
|
|
// 缺失时回退 debug 签名(CI/他人克隆仓库仍可构建)。
|
|
|
|
|
|
val keystoreProps = Properties().apply {
|
|
|
|
|
|
val f = rootProject.file("app/key.properties")
|
|
|
|
|
|
if (f.exists()) f.inputStream().use { load(it) }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-19 00:22:04 +08:00
|
|
|
|
buildTypes {
|
|
|
|
|
|
release {
|
2026-09-23 17:15:51 +08:00
|
|
|
|
signingConfig = if (keystoreProps.getProperty("storeFile") != null) {
|
|
|
|
|
|
signingConfigs.create("release") {
|
|
|
|
|
|
storeFile = rootProject.file("app/" + keystoreProps.getProperty("storeFile"))
|
|
|
|
|
|
storePassword = keystoreProps.getProperty("storePassword")
|
|
|
|
|
|
keyAlias = keystoreProps.getProperty("keyAlias")
|
|
|
|
|
|
keyPassword = keystoreProps.getProperty("keyPassword")
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Signing with the debug keys(无正式签名配置的构建机回退)。
|
|
|
|
|
|
signingConfigs.getByName("debug")
|
|
|
|
|
|
}
|
2026-09-22 13:55:37 +08:00
|
|
|
|
// R8 混淆会破坏 WorkManager 反射初始化(NoSuchMethodException
|
|
|
|
|
|
// WorkDatabase_Impl),ProGuard keep 规则见 proguard-rules.pro。
|
|
|
|
|
|
isMinifyEnabled = true
|
|
|
|
|
|
proguardFiles(
|
|
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
|
|
"proguard-rules.pro"
|
|
|
|
|
|
)
|
2026-09-19 00:22:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
kotlin {
|
|
|
|
|
|
compilerOptions {
|
|
|
|
|
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-19 03:22:42 +08:00
|
|
|
|
dependencies {
|
|
|
|
|
|
// P3 Task 7 后台上传桥接:WorkManager(expedited + dataSync 前台服务)
|
2026-09-28 14:22:24 +08:00
|
|
|
|
// + OkHttp 直传 presign PUT(声明 4.12.0,Gradle 冲突仲裁实际解析
|
|
|
|
|
|
// 5.2.1——fluwx 传递依赖胜出;独立实例、与 Flutter 引擎无耦合不变)。
|
2026-09-19 03:22:42 +08:00
|
|
|
|
implementation("androidx.work:work-runtime-ktx:2.10.0")
|
|
|
|
|
|
implementation("androidx.core:core-ktx:1.15.0")
|
|
|
|
|
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
|
|
|
|
|
testImplementation("junit:junit:4.13.2")
|
2026-09-28 14:10:14 +08:00
|
|
|
|
// mockwebserver 须对齐实际解析的 okhttp:fluwx 传递 okhttp 5.x
|
|
|
|
|
|
// (冲突调解覆盖本模块 4.12 声明),4.12 的 mockwebserver 在 5.x
|
|
|
|
|
|
// 运行时缺 okhttp3.internal.Util → NoClassDefFoundError。
|
|
|
|
|
|
testImplementation("com.squareup.okhttp3:mockwebserver:5.2.1")
|
2026-09-19 03:22:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-09-19 00:22:04 +08:00
|
|
|
|
flutter {
|
|
|
|
|
|
source = "../.."
|
|
|
|
|
|
}
|