You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
5.8 KiB
150 lines
5.8 KiB
plugins {
|
|
id("com.android.application")
|
|
id("kotlin-android")
|
|
id("org.jetbrains.kotlin.plugin.serialization") version "1.4.32"
|
|
id("kotlin-kapt")
|
|
}
|
|
|
|
android {
|
|
compileSdk = 30
|
|
|
|
defaultConfig {
|
|
applicationId = "com.gyf.csams"
|
|
minSdk = 21
|
|
targetSdk = 30
|
|
versionCode = 1
|
|
versionName = "1.0"
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables {
|
|
useSupportLibrary = true
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
val appName="${rootProject.extra["APP_NAME"]}"
|
|
val serverAddress=rootProject.extra["SERVER_ADDRESS"]
|
|
debug {
|
|
manifestPlaceholders(mapOf("APP_NAME" to appName))
|
|
buildConfigField(type="String",name="APP_NAME",value = "\"$appName\"")
|
|
buildConfigField(type="String",name="SERVER_ADDRESS",value = "\"$serverAddress\"")
|
|
}
|
|
release {
|
|
isMinifyEnabled = false
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
manifestPlaceholders(mapOf("APP_NAME" to appName))
|
|
buildConfigField(type="String",name="APP_NAME",value = "\"$appName\"")
|
|
buildConfigField(type="String",name="SERVER_ADDRESS",value = "\"$serverAddress\"")
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = "1.8"
|
|
useIR = true
|
|
}
|
|
buildFeatures {
|
|
compose = true
|
|
}
|
|
composeOptions {
|
|
kotlinCompilerExtensionVersion = rootProject.extra["compose_version"] as String
|
|
}
|
|
packagingOptions {
|
|
resources.excludes.add("META-INF/AL2.0")
|
|
resources.excludes.add("META-INF/LGPL2.1")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
/**
|
|
* 针对最新的平台功能和 API 调整应用,同时还支持旧设备。
|
|
* https://developer.android.com/jetpack/androidx/releases/core
|
|
*/
|
|
implementation("androidx.core:core-ktx:1.3.2")
|
|
/**
|
|
* 允许在平台旧版 API 上访问新 API(很多使用 Material Design)。
|
|
* https://developer.android.com/jetpack/androidx/releases/appcompat
|
|
*/
|
|
implementation("androidx.appcompat:appcompat:1.2.0")
|
|
/**
|
|
* 与设备互动所需的 Compose UI 的基本组件,包括布局、绘图和输入。
|
|
* https://developer.android.com/jetpack/androidx/releases/compose-ui
|
|
*/
|
|
implementation("androidx.compose.ui:ui:${rootProject.extra["compose_version"]}")
|
|
implementation("androidx.compose.ui:ui-tooling:${rootProject.extra["compose_version"]}")
|
|
/**
|
|
* Compose 的编程模型和状态管理的基本构建块,以及 Compose 编译器插件针对的核心运行时。
|
|
* https://developer.android.com/jetpack/androidx/releases/compose-runtime
|
|
*/
|
|
implementation("androidx.compose.runtime:runtime-livedata:${rootProject.extra["compose_version"]}")
|
|
//Material Components
|
|
implementation("com.google.android.material:material:1.3.0")
|
|
/**
|
|
* 使用现成可用的 Material Design 组件构建 Jetpack Compose UI。这是更高层级的 Compose 入口点,旨在提供与 www.material.io 上描述的组件一致的组件。
|
|
* https://developer.android.com/jetpack/androidx/releases/compose-material
|
|
*/
|
|
implementation("androidx.compose.material:material:${rootProject.extra["compose_version"]}")
|
|
/**
|
|
* 生命周期感知型组件
|
|
* https://developer.android.com/jetpack/androidx/releases/lifecycle
|
|
*/
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:${rootProject.extra["lifecycle_version"]}")
|
|
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04")
|
|
/**
|
|
* 访问基于 Activity 构建的可组合 API。
|
|
* https://developer.android.com/jetpack/androidx/releases/activity
|
|
*/
|
|
implementation("androidx.activity:activity-compose:1.3.0-alpha07")
|
|
/**
|
|
* Simple, pretty and powerful logger for android
|
|
* https://github.com/orhanobut/logger
|
|
*/
|
|
implementation("com.orhanobut:logger:2.2.0")
|
|
/**
|
|
*
|
|
* https://github.com/square/okhttp
|
|
*/
|
|
implementation("com.squareup.okhttp3:okhttp:4.9.1")
|
|
/**
|
|
* https://github.com/google/gson
|
|
*/
|
|
implementation("com.google.code.gson:gson:2.8.6")
|
|
/**
|
|
* https://kotlinlang.org/docs/serialization.html
|
|
*/
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
|
|
/**
|
|
* https://developer.android.com/jetpack/androidx/releases/navigation
|
|
*/
|
|
implementation("androidx.navigation:navigation-compose:1.0.0-alpha10")
|
|
/**
|
|
* https://developer.android.com/jetpack/androidx/releases/room
|
|
*/
|
|
implementation("androidx.room:room-runtime:${rootProject.extra["room_version"]}")
|
|
kapt("androidx.room:room-compiler:${rootProject.extra["room_version"]}")
|
|
// optional - Kotlin Extensions and Coroutines support for Room
|
|
implementation("androidx.room:room-ktx:${rootProject.extra["room_version"]}")
|
|
// optional - Test helpers
|
|
testImplementation("androidx.room:room-testing:${rootProject.extra["room_version"]}")
|
|
//测试
|
|
testImplementation("junit:junit:4.13.2")
|
|
/**
|
|
* A cross environment JUnit4 runner for Android tests.
|
|
* https://developer.android.com/reference/androidx/test/ext/junit/runners/package-summary?hl=en
|
|
*/
|
|
androidTestImplementation("androidx.test.ext:junit:1.1.2")
|
|
/**
|
|
* https://developer.android.com/training/testing/espresso
|
|
* 使用 Espresso 来编写简洁、美观且可靠的 Android 界面测试。
|
|
* 包含核心和基本的 View 匹配器、操作和断言
|
|
*/
|
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
|
|
androidTestImplementation("androidx.compose.ui:ui-test-junit4:${rootProject.extra["compose_version"]}")
|
|
|
|
|
|
} |