140 lines
5.5 KiB
Kotlin
140 lines
5.5 KiB
Kotlin
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.compose)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.ksp)
|
|
alias(libs.plugins.hilt)
|
|
}
|
|
|
|
android {
|
|
namespace = "com.jishisongfu.duobibi"
|
|
compileSdk = 36
|
|
|
|
defaultConfig {
|
|
applicationId = "com.jishisongfu.duobibi"
|
|
minSdk = 26
|
|
targetSdk = 34
|
|
versionCode = 1
|
|
versionName = "1.0.0"
|
|
|
|
vectorDrawables { useSupportLibrary = true }
|
|
|
|
// 极光一键登录 / 运营商 SDK 含 native 库,只保留主流 ABI
|
|
ndk {
|
|
abiFilters += listOf("armeabi-v7a", "arm64-v8a")
|
|
}
|
|
|
|
// 极光 AppKey 通过 manifest 占位符注入(SDK 校验 包名+签名+AppKey 三元组)。
|
|
// 占位值,需在极光控制台注册"多比比"新应用后替换。
|
|
manifestPlaceholders["JPUSH_APPKEY"] = "966b451a8d9cfe12d173ea9d"
|
|
manifestPlaceholders["JPUSH_CHANNEL"] = "developer-default"
|
|
}
|
|
|
|
signingConfigs {
|
|
create("release") {
|
|
// 多比比自己的 keystore:从 ~/.gradle/gradle.properties 或 -P 注入,不硬编码路径/密码。
|
|
// 未提供时 release 不签名;debug 走默认 debug.keystore,可直接 assembleDebug。
|
|
val ksPath = (project.findProperty("DUOBIBI_KEYSTORE") as String?).orEmpty()
|
|
if (ksPath.isNotEmpty() && file(ksPath).exists()) {
|
|
storeFile = file(ksPath)
|
|
storePassword = (project.findProperty("DUOBIBI_STORE_PASSWORD") as String?).orEmpty()
|
|
keyAlias = (project.findProperty("DUOBIBI_KEY_ALIAS") as String?).orEmpty()
|
|
keyPassword = (project.findProperty("DUOBIBI_KEY_PASSWORD") as String?).orEmpty()
|
|
// 4 大国产商店对 V1+V2 双签兼容性最好;V3 由 AGP 默认处理
|
|
enableV1Signing = true
|
|
enableV2Signing = true
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
buildConfigField("String", "BASE_URL", "\"https://api.duobibi.com/\"")
|
|
// 心跳 PoC mock 后端(本机 LAN),独立端口 8766。生产化改真后端 https。
|
|
buildConfigField("String", "HEARTBEAT_BASE_URL", "\"http://192.168.0.109:8766\"")
|
|
if ((project.findProperty("DUOBIBI_KEYSTORE") as String?)?.isNotEmpty() == true) {
|
|
signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
debug {
|
|
isMinifyEnabled = false
|
|
// 本机联调:debug 走 loopback,需先在宿主执行 `adb reverse tcp:8766 tcp:8766`
|
|
// 把模拟器内 127.0.0.1:8766 反向映射到宿主 8766。
|
|
// 为什么不直接用 10.0.2.2:模拟器 IPv6 dual-stack 默认走 IPv6 出站,但模拟器
|
|
// 内核 IPv6 路由不通,直接 ENETUNREACH (force-stop 后必现)。走 loopback 绕开。
|
|
// 线上/release 仍为 https://api.duobibi.com/(见上方 release 块)。
|
|
buildConfigField("String", "BASE_URL", "\"http://127.0.0.1:8766/\"")
|
|
buildConfigField("String", "HEARTBEAT_BASE_URL", "\"http://192.168.0.109:8766\"")
|
|
// debug 用默认 debug.keystore,可直接 assembleDebug 出包。
|
|
// 一键登录在极光控制台按"包名+签名 MD5"校验,真机联调登录请用配置了
|
|
// DUOBIBI_KEYSTORE 的 release 包(签名 MD5 需与控制台一致)。
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = "17"
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
buildConfig = true
|
|
}
|
|
|
|
packaging {
|
|
resources {
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
|
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
|
implementation(libs.androidx.lifecycle.runtime.compose)
|
|
implementation(libs.androidx.activity.compose)
|
|
|
|
implementation(platform(libs.androidx.compose.bom))
|
|
implementation(libs.androidx.compose.ui)
|
|
implementation(libs.androidx.compose.ui.graphics)
|
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
|
implementation(libs.androidx.compose.material3)
|
|
implementation(libs.androidx.compose.material.icons.extended)
|
|
implementation(libs.androidx.navigation.compose)
|
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
|
|
|
implementation(libs.androidx.room.runtime)
|
|
implementation(libs.androidx.room.ktx)
|
|
ksp(libs.androidx.room.compiler)
|
|
|
|
implementation(libs.hilt.android)
|
|
ksp(libs.hilt.compiler)
|
|
implementation(libs.androidx.hilt.navigation.compose)
|
|
|
|
implementation(libs.retrofit)
|
|
implementation(libs.retrofit.kotlinx.serialization)
|
|
implementation(libs.okhttp)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
|
|
implementation(libs.kotlinx.coroutines.android)
|
|
|
|
// 小米推送 SDK 7.9.2 (C 3rd)。aar 内置 manifest 自动 merge 全部组件 + 权限,
|
|
// 业务方仅需注册自家 PushMessageReceiver 子类(见 push/MiPushReceiver.kt)。
|
|
implementation(files("libs/MiPush_SDK_Client_7_9_2-C_3rd.aar"))
|
|
|
|
// 极光一键登录(jverification 3.0+ 自带 JCore)
|
|
implementation("cn.jiguang.sdk:jverification:3.1.7")
|
|
}
|