- Gradle 升级至 8.13,Android Gradle 插件升级至 8.13.2 - compileSdk/targetSdk 升级至 36,namespace 替代 package - 引入 Kotlin 插件与协程依赖,统一 stdlib 版本 - 精简打包输出命名,移除过时配置与 abiFilters - 修复 manifest exported 属性与 CMake 链接对齐
195 lines
6.5 KiB
Groovy
195 lines
6.5 KiB
Groovy
plugins {
|
||
id 'com.android.application'
|
||
id 'org.jetbrains.kotlin.android'
|
||
// id 'kotlin-kapt'
|
||
}
|
||
|
||
|
||
def appName() {
|
||
return "Mir4Updater"
|
||
}
|
||
|
||
def releaseTime() {
|
||
return new Date().format("yyyyMMdd_HHmmss", TimeZone.getDefault())
|
||
}
|
||
|
||
android {
|
||
namespace "com.example.mir4updater"
|
||
|
||
compileSdkVersion 36
|
||
buildToolsVersion "36.0.0"
|
||
|
||
defaultConfig {
|
||
applicationId "com.example.mir4updater"
|
||
minSdkVersion 24
|
||
targetSdkVersion 36
|
||
versionCode 1
|
||
versionName "1.0"
|
||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
|
||
vectorDrawables.useSupportLibrary = true
|
||
|
||
ndk {
|
||
//可以根据需要来自行选择并添加对应cpu类型的.so库。
|
||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||
// 还可以添加 'armeabi', 'x86', 'x86_64', 'mips', 'mips64'
|
||
}
|
||
|
||
}
|
||
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_1_8
|
||
targetCompatibility JavaVersion.VERSION_1_8
|
||
}
|
||
|
||
|
||
buildFeatures {
|
||
dataBinding true
|
||
buildConfig true
|
||
aidl true
|
||
}
|
||
|
||
// splits {
|
||
// abi {
|
||
// enable true
|
||
// reset()
|
||
// include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' // 指定分包的架构
|
||
// universalApk true // 是否生成包含所有 ABI 的通用 APK
|
||
// }
|
||
// }
|
||
|
||
signingConfigs {
|
||
own {
|
||
storeFile file("keystore/ttstd.jks")
|
||
storePassword "fht19961207"
|
||
keyAlias "key0"
|
||
keyPassword "981964879aa"
|
||
v1SigningEnabled true
|
||
v2SigningEnabled true
|
||
}
|
||
}
|
||
|
||
//多版本
|
||
// productFlavors {
|
||
// official {
|
||
// flavorDimensions "default"
|
||
// versionCode 1
|
||
// versionName "1.0"
|
||
// buildConfigField "String", "ROOT_URL", '"http://139.199.77.221:8080"'
|
||
// }
|
||
//
|
||
// beta {
|
||
// flavorDimensions "default"
|
||
// versionCode 100
|
||
// versionName "1.0"
|
||
// buildConfigField "String", "ROOT_URL", '"http://127.0.0.1:65534"'
|
||
// }
|
||
// }
|
||
|
||
buildTypes {
|
||
debug {
|
||
versionNameSuffix "_debug"
|
||
minifyEnabled false
|
||
signingConfig signingConfigs.own
|
||
}
|
||
|
||
release {
|
||
minifyEnabled false
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
signingConfig signingConfigs.own
|
||
}
|
||
}
|
||
|
||
android.applicationVariants.all { variant ->
|
||
variant.outputs.all { output -> // 改为 all
|
||
def buildType = variant.buildType.name
|
||
if (buildType.contains("debug")) {
|
||
outputFileName = "${appName()}_V${defaultConfig.versionName}_${releaseTime()}.apk"
|
||
} else {
|
||
outputFileName = "${appName()}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
dependencies {
|
||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||
implementation project(path: ':ttutils')
|
||
|
||
// 添加 Kotlin 标准库
|
||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||
// 添加这行,使用 BOM 统一 Kotlin 相关库的版本
|
||
implementation(platform("org.jetbrains.kotlin:kotlin-bom:$kotlin_version"))
|
||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0'
|
||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.11.0'
|
||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx3:1.11.0'
|
||
|
||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
||
implementation "androidx.viewpager2:viewpager2:1.0.0"
|
||
implementation "androidx.fragment:fragment:1.4.1"
|
||
implementation "androidx.documentfile:documentfile:1.0.1"
|
||
|
||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||
testImplementation 'junit:junit:4.12'
|
||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||
|
||
implementation 'com.google.android.play:app-update:2.1.0'
|
||
implementation 'com.google.android.play:app-update-ktx:2.1.0' // Kotlin扩展
|
||
|
||
//RxJava
|
||
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
|
||
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
|
||
|
||
//okhttp
|
||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
|
||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
|
||
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
|
||
implementation "com.squareup.retrofit2:adapter-rxjava3:2.9.0"
|
||
// gson converter
|
||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||
// 标准转换器,去掉 Retrofit以Mutipart上传参数时,String参数会多一对双引号
|
||
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
|
||
//google
|
||
implementation 'com.google.code.gson:gson:2.9.0'
|
||
implementation 'com.google.zxing:core:3.5.0'
|
||
//生命周期管理
|
||
implementation 'com.trello.rxlifecycle4:rxlifecycle:4.0.2'
|
||
implementation 'com.trello.rxlifecycle4:rxlifecycle-android:4.0.2'
|
||
implementation 'com.trello.rxlifecycle4:rxlifecycle-components:4.0.2'
|
||
implementation 'com.trello.rxlifecycle4:rxlifecycle-components-preference:4.0.2'
|
||
implementation 'com.trello.rxlifecycle4:rxlifecycle-android-lifecycle:4.0.2'
|
||
|
||
implementation 'com.jakewharton.rxbinding4:rxbinding:4.0.0'
|
||
implementation 'com.jeremyliao:live-event-bus-x:1.7.3'
|
||
|
||
//MMKV
|
||
implementation 'com.tencent:mmkv-static:1.2.14'
|
||
//bugly
|
||
implementation 'com.tencent.bugly:crashreport:4.1.9.2'
|
||
//xcrash
|
||
implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.1.0'
|
||
//阿里云推送
|
||
implementation 'com.aliyun.ams:alicloud-android-push:3.9.3'
|
||
|
||
//工具类
|
||
implementation 'com.blankj:utilcodex:1.31.1'
|
||
//压缩文件解压
|
||
implementation 'org.zeroturnaround:zt-zip:1.15'
|
||
//动态权限框架
|
||
implementation 'com.github.getActivity:XXPermissions:18.6'
|
||
// 吐司框架:https://github.com/getActivity/Toaster
|
||
implementation 'com.github.getActivity:Toaster:12.6'
|
||
//沉浸状态栏
|
||
implementation 'com.gitee.zackratos:UltimateBarX:0.8.0'
|
||
implementation 'com.github.andywu91:XAPKInstaller:1.0.0'
|
||
//Java WebSocket
|
||
implementation "org.java-websocket:Java-WebSocket:1.5.3"
|
||
}
|