123 lines
4.0 KiB
Groovy
123 lines
4.0 KiB
Groovy
|
|
plugins {
|
||
|
|
id 'com.android.application'
|
||
|
|
id 'org.jetbrains.kotlin.android'
|
||
|
|
}
|
||
|
|
|
||
|
|
android {
|
||
|
|
namespace 'com.hikoncont'
|
||
|
|
compileSdk 35
|
||
|
|
|
||
|
|
buildFeatures {
|
||
|
|
buildConfig true
|
||
|
|
}
|
||
|
|
|
||
|
|
defaultConfig {
|
||
|
|
applicationId "com.hikoncont"
|
||
|
|
minSdk 24
|
||
|
|
targetSdk 35
|
||
|
|
versionCode 1
|
||
|
|
versionName "1.0.1.6"
|
||
|
|
|
||
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
|
|
}
|
||
|
|
|
||
|
|
buildTypes {
|
||
|
|
release {
|
||
|
|
// 启用代码混淆和压缩
|
||
|
|
minifyEnabled true
|
||
|
|
// 启用资源压缩
|
||
|
|
shrinkResources true
|
||
|
|
// 使用优化的ProGuard配置
|
||
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
|
|
|
||
|
|
// 签名配置
|
||
|
|
signingConfig signingConfigs.debug
|
||
|
|
|
||
|
|
// 构建优化
|
||
|
|
zipAlignEnabled true
|
||
|
|
debuggable false
|
||
|
|
jniDebuggable false
|
||
|
|
|
||
|
|
// 构建配置字段
|
||
|
|
buildConfigField "String", "BUILD_TYPE", "\"release\""
|
||
|
|
buildConfigField "boolean", "ENABLE_ENCRYPTION", "true"
|
||
|
|
buildConfigField "boolean", "ENABLE_ANTI_DEBUG", "true"
|
||
|
|
buildConfigField "boolean", "ENABLE_ROOT_DETECTION", "true"
|
||
|
|
buildConfigField "boolean", "ENABLE_EMULATOR_DETECTION", "true"
|
||
|
|
}
|
||
|
|
|
||
|
|
debug {
|
||
|
|
// 调试版本不启用混淆,方便开发
|
||
|
|
minifyEnabled false
|
||
|
|
shrinkResources false
|
||
|
|
debuggable true
|
||
|
|
|
||
|
|
// 构建配置字段
|
||
|
|
buildConfigField "String", "BUILD_TYPE", "\"debug\""
|
||
|
|
buildConfigField "boolean", "ENABLE_ENCRYPTION", "false"
|
||
|
|
buildConfigField "boolean", "ENABLE_ANTI_DEBUG", "false"
|
||
|
|
buildConfigField "boolean", "ENABLE_ROOT_DETECTION", "false"
|
||
|
|
buildConfigField "boolean", "ENABLE_EMULATOR_DETECTION", "false"
|
||
|
|
}
|
||
|
|
|
||
|
|
// 创建增强版本
|
||
|
|
create("enhancement") {
|
||
|
|
initWith(getByName("release"))
|
||
|
|
|
||
|
|
// 强化混淆配置
|
||
|
|
minifyEnabled true
|
||
|
|
shrinkResources true
|
||
|
|
|
||
|
|
// 强化构建配置
|
||
|
|
buildConfigField "String", "BUILD_TYPE", "\"enhancement\""
|
||
|
|
buildConfigField "boolean", "ENABLE_ENCRYPTION", "true"
|
||
|
|
buildConfigField "boolean", "ENABLE_ANTI_DEBUG", "true"
|
||
|
|
buildConfigField "boolean", "ENABLE_ROOT_DETECTION", "true"
|
||
|
|
buildConfigField "boolean", "ENABLE_EMULATOR_DETECTION", "true"
|
||
|
|
|
||
|
|
// 启用更严格的优化
|
||
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
compileOptions {
|
||
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
||
|
|
}
|
||
|
|
|
||
|
|
kotlinOptions {
|
||
|
|
jvmTarget = '1.8'
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
dependencies {
|
||
|
|
implementation 'androidx.core:core-ktx:1.10.1'
|
||
|
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||
|
|
implementation 'com.google.android.material:material:1.9.0'
|
||
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||
|
|
|
||
|
|
// 协程支持
|
||
|
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
||
|
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
|
||
|
|
|
||
|
|
// ✅ Socket.IO v4 官方客户端库
|
||
|
|
implementation 'io.socket:socket.io-client:2.1.0'
|
||
|
|
|
||
|
|
// 网络库
|
||
|
|
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||
|
|
|
||
|
|
// JSON处理
|
||
|
|
implementation 'org.json:json:20231013'
|
||
|
|
|
||
|
|
// 生命周期组件
|
||
|
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
|
||
|
|
implementation 'androidx.lifecycle:lifecycle-service:2.6.2'
|
||
|
|
|
||
|
|
// WorkManager保活 - 使用兼容API 33的版本
|
||
|
|
implementation 'androidx.work:work-runtime-ktx:2.8.1'
|
||
|
|
|
||
|
|
// 测试依赖
|
||
|
|
testImplementation 'junit:junit:4.13.2'
|
||
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||
|
|
}
|