plugins { id("com.android.application") id("kotlin-android") } 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"]}" debug { manifestPlaceholders(mapOf("APP_NAME" to appName)) buildConfigField(type="String",name="APP_NAME",value = "\"$appName\"") } 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\"") } } 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 } } 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-alpha06") /** * Simple, pretty and powerful logger for android * https://github.com/orhanobut/logger */ implementation("com.orhanobut:logger:2.2.0") //测试 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"]}") }