107 lines
3.0 KiB
Groovy
107 lines
3.0 KiB
Groovy
plugins {
|
||
alias(libs.plugins.android.application)
|
||
}
|
||
|
||
android {
|
||
namespace 'com.example.retention'
|
||
compileSdk 35
|
||
|
||
signingConfigs {
|
||
release {
|
||
storeFile file('agent_retention.jks')
|
||
storePassword 'agent_retention'
|
||
keyAlias 'agent_retention'
|
||
keyPassword 'agent_retention'
|
||
}
|
||
}
|
||
|
||
defaultConfig {
|
||
applicationId "com.example.retention"
|
||
minSdk 24
|
||
targetSdk 35
|
||
versionCode 1
|
||
versionName "1.0"
|
||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||
|
||
// 指定支持的 ABI 类型(如果需要限制支持的 ABI)
|
||
externalNativeBuild {
|
||
cmake {
|
||
arguments "-DANDROID_ABI=arm64-v8a"
|
||
}
|
||
}
|
||
sourceSets {
|
||
main {
|
||
jniLibs.srcDirs = ['src/main/jniLibs']
|
||
}
|
||
}
|
||
}
|
||
|
||
buildTypes {
|
||
release {
|
||
signingConfig signingConfigs.release
|
||
minifyEnabled true
|
||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||
}
|
||
debug {
|
||
// 禁用符号剥离
|
||
ndk {
|
||
debugSymbolLevel 'none'
|
||
}
|
||
}
|
||
}
|
||
compileOptions {
|
||
sourceCompatibility JavaVersion.VERSION_11
|
||
targetCompatibility JavaVersion.VERSION_11
|
||
}
|
||
|
||
// 添加 CMake 支持
|
||
externalNativeBuild {
|
||
cmake {
|
||
// 指定 CMakeLists.txt 的路径
|
||
path file("src/main/cpp/CMakeLists.txt")
|
||
}
|
||
}
|
||
|
||
applicationVariants.all { variant ->
|
||
variant.outputs.all { output ->
|
||
def versionName = variant.versionName ?: "1.0"
|
||
def versionCode = variant.versionCode ?: 1
|
||
output.outputFileName = "app-${variant.applicationId}-v${versionName}-${versionCode}.apk"
|
||
}
|
||
}
|
||
}
|
||
|
||
dependencies {
|
||
implementation libs.appcompat
|
||
implementation libs.material
|
||
implementation libs.activity
|
||
implementation libs.constraintlayout
|
||
implementation libs.play.services.ads.identifier
|
||
testImplementation libs.junit
|
||
androidTestImplementation libs.ext.junit
|
||
androidTestImplementation libs.espresso.core
|
||
|
||
implementation 'androidx.work:work-runtime:2.9.0'
|
||
// Retrofit 核心库
|
||
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
||
|
||
// 如果需要用 Gson 作为 JSON 序列化/反序列化工具,还需添加以下依赖
|
||
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
||
|
||
// 如果需要 RxJava 支持(可选)
|
||
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'
|
||
|
||
implementation 'org.nanohttpd:nanohttpd:2.3.1'
|
||
|
||
// 添加 Mockito 核心依赖
|
||
testImplementation 'org.mockito:mockito-core:5.4.0'
|
||
|
||
// 如果需要在 Android Instrumented Tests 中使用 Mockito
|
||
androidTestImplementation 'org.mockito:mockito-android:5.4.0'
|
||
|
||
testImplementation 'junit:junit:4.13.2'
|
||
testImplementation 'org.mockito:mockito-inline:4.8.0'
|
||
|
||
}
|