Files
ElderlyDialerMdm/app/build.gradle
tongtongstudio e3bf43caeb refactor(mdm): 抽象IMdmManager接口并支持多平台构建
移除AdminManager具体实现,引入IMdmManager接口以实现平台解耦。
重构MainActivity,通过接口调用MDM功能。
新增honor、huawei、emui产品变体,支持多平台编译。
添加AGENTS.md开发规范文件。
2026-08-04 18:01:18 +08:00

152 lines
4.8 KiB
Groovy
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
apply plugin: 'com.android.application'
static def appName() {
return "ElderlyDialerMdm"
}
static def releaseTime() {
return new Date().format("yyyyMMdd_HHmmss", TimeZone.getDefault())
}
android {
namespace "com.ttstd.sn"
compileSdkVersion 33
defaultConfig {
applicationId "com.ttstd.sn"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 23
targetSdkVersion 33
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
dataBinding true
buildConfig true
aidl true
}
// 平台维度honor荣耀 MagicOS/ huawei华为 MDM Kit/ emui华为 EMUI
flavorDimensions "platform"
productFlavors {
honor {
dimension "platform"
versionNameSuffix "_honor"
buildConfigField "String", "PLATFORM", '"honor"'
}
huawei {
dimension "platform"
versionNameSuffix "_huawei"
buildConfigField "String", "PLATFORM", '"huawei"'
}
emui {
dimension "platform"
versionNameSuffix "_emui"
buildConfigField "String", "PLATFORM", '"emui"'
}
}
buildTypes {
debug {
debuggable true
versionNameSuffix "_debug"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
//混淆
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// Add application variant configuration here instead
applicationVariants.all { variant ->
variant.outputs.each { output ->
def buildType = variant.buildType.name
def flavorName = variant.flavorName
if (buildType.contains("debug")) {
output.outputFileName = "app_${flavorName}_debug.apk"
} else {
output.outputFileName = "${appName()}_${flavorName}_${variant.versionCode}_V${variant.versionName}_${releaseTime()}_${buildType}.apk"
}
}
}
}
dependencies {
// 荣耀 MDM SDKcompileOnly仅编译期
honorCompileOnly files('libs/magic-android-34.38.1.200.jar')
// 华为 MDM KitcompileOnly仅编译期
huaweiCompileOnly 'com.huawei.mdm:mdmkit:11.1.0.300'
// 华为 HEM License SDK可选需要授权校验时放开
//huaweiImplementation 'com.huawei.hms:hemsdk:1.0.4.303'
// 华为 EMUI MDM SDKcompileOnly仅编译期
emuiCompileOnly files('libs/hw_emui_11.0.1_20210408.jar')
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
//AnnotationsBaseRxService 使用 @NotNull
implementation 'org.jetbrains:annotations:24.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//RxJava
implementation 'io.reactivex.rxjava3:rxjava:3.0.0'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.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-android-lifecycle:4.0.2'
//图片加载框架
implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
//状态栏透明
implementation 'com.gitee.zackratos:UltimateBarX:0.8.0'
}
// 在 dependencies 之后添加
project.afterEvaluate {
android.applicationVariants.all { variant ->
variant.javaCompileProvider.get().options.bootstrapClasspath = files(
file('libs/framework.jar'),
android.getBootClasspath()
)
}
}