2025-05-20 16:39:05 +08:00
|
|
|
|
plugins {
|
|
|
|
|
alias(libs.plugins.android.application)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
namespace 'com.example.studyapp'
|
|
|
|
|
compileSdk 35
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
applicationId "com.example.studyapp"
|
|
|
|
|
minSdk 24
|
|
|
|
|
targetSdk 35
|
|
|
|
|
versionCode 1
|
|
|
|
|
versionName "1.0"
|
|
|
|
|
|
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
2025-05-29 22:05:49 +08:00
|
|
|
|
|
|
|
|
|
// 指定支持的 ABI 类型(如果需要限制支持的 ABI)
|
|
|
|
|
externalNativeBuild {
|
|
|
|
|
cmake {
|
|
|
|
|
arguments "-DANDROID_ABI=arm64-v8a"
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-20 16:39:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
|
release {
|
|
|
|
|
minifyEnabled false
|
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
|
|
|
}
|
2025-05-29 22:05:49 +08:00
|
|
|
|
debug {
|
|
|
|
|
// 禁用符号剥离
|
|
|
|
|
ndk {
|
|
|
|
|
debugSymbolLevel 'none'
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-20 16:39:05 +08:00
|
|
|
|
}
|
|
|
|
|
compileOptions {
|
|
|
|
|
sourceCompatibility JavaVersion.VERSION_11
|
|
|
|
|
targetCompatibility JavaVersion.VERSION_11
|
|
|
|
|
}
|
2025-05-29 22:05:49 +08:00
|
|
|
|
|
|
|
|
|
// 添加 CMake 支持
|
|
|
|
|
externalNativeBuild {
|
|
|
|
|
cmake {
|
|
|
|
|
// 指定 CMakeLists.txt 的路径
|
|
|
|
|
path file("src/main/cpp/CMakeLists.txt")
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-05-20 16:39:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation libs.appcompat
|
|
|
|
|
implementation libs.material
|
|
|
|
|
implementation libs.activity
|
|
|
|
|
implementation libs.constraintlayout
|
|
|
|
|
testImplementation libs.junit
|
|
|
|
|
androidTestImplementation libs.ext.junit
|
|
|
|
|
androidTestImplementation libs.espresso.core
|
2025-05-29 22:05:49 +08:00
|
|
|
|
|
2025-05-22 18:13:34 +08:00
|
|
|
|
// 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'
|
2025-05-20 16:39:05 +08:00
|
|
|
|
}
|