plugins { id("com.android.library") id("kotlin-android") // id("org.jetbrains.kotlin.plugin.serialization") version "1.4.32" id("kotlin-kapt") } android { compileSdk = 30 defaultConfig { minSdk = 21 targetSdk = 30 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") } buildTypes { val serverAddress by extra("http://192.168.50.107:8080") debug { buildConfigField(type = "String", name = "SERVER_ADDRESS", value = "\"$serverAddress\"") } release { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) buildConfigField(type = "String", name = "SERVER_ADDRESS", value = "\"$serverAddress\"") } } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = "1.8" freeCompilerArgs = listOf( "-P", "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true" ) } buildFeatures { compose = true } } dependencies { //生命周期组件版本 val lifecycle_version = "2.3.1" //https://developer.android.com/topic/libraries/architecture/workmanager/basics?hl=zh-cn val room_version = "2.3.0" val accompanist_version = "0.10.0" //https://github.com/google/accompanist api("com.google.accompanist:accompanist-insets:$accompanist_version") api("com.google.accompanist:accompanist-systemuicontroller:$accompanist_version") api("com.google.accompanist:accompanist-coil:$accompanist_version") /** * 针对最新的平台功能和 API 调整应用,同时还支持旧设备。 * https://developer.android.com/jetpack/androidx/releases/core */ api("androidx.core:core-ktx:1.5.0") /** * 允许在平台旧版 API 上访问新 API(很多使用 Material Design)。 * https://developer.android.com/jetpack/androidx/releases/appcompat */ api("androidx.appcompat:appcompat:1.3.0") /** * 与设备互动所需的 Compose UI 的基本组件,包括布局、绘图和输入。 * https://developer.android.com/jetpack/androidx/releases/compose-ui */ api("androidx.compose.ui:ui:${rootProject.extra["compose_version"]}") api("androidx.compose.ui:ui-tooling:${rootProject.extra["compose_version"]}") /** * Compose 的编程模型和状态管理的基本构建块,以及 Compose 编译器插件针对的核心运行时。 * https://developer.android.com/jetpack/androidx/releases/compose-runtime */ api("androidx.compose.runtime:runtime-livedata:${rootProject.extra["compose_version"]}") //Material Components api("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 */ api("androidx.compose.material:material:${rootProject.extra["compose_version"]}") /** * 生命周期感知型组件 * https://developer.android.com/jetpack/androidx/releases/lifecycle */ api("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version") api("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha05") /** * 访问基于 Activity 构建的可组合 API。 * https://developer.android.com/jetpack/androidx/releases/activity */ api("androidx.activity:activity-compose:1.3.0-alpha08") /** * Simple, pretty and powerful logger for android * https://github.com/orhanobut/logger */ api("com.orhanobut:logger:2.2.0") /** * * https://github.com/square/okhttp */ api("com.squareup.okhttp3:okhttp:4.9.1") /** * https://github.com/google/gson */ api("com.google.code.gson:gson:2.8.6") /** * https://kotlinlang.org/docs/serialization.html */ api("org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1") /** * https://developer.android.com/jetpack/androidx/releases/navigation */ api("androidx.navigation:navigation-compose:2.4.0-alpha01") /** * https://developer.android.com/jetpack/androidx/releases/fragment */ api("androidx.fragment:fragment-ktx:1.3.4") /** * https://developer.android.com/jetpack/androidx/releases/room */ api("androidx.room:room-runtime:$room_version") // optional - Kotlin Extensions and Coroutines support for Room api("androidx.room:room-ktx:$room_version") kapt("androidx.room:room-compiler:$room_version") // optional - Test helpers testImplementation("androidx.room:room-testing:$room_version") // https://github.com/coil-kt/coil/blob/master/README-zh.md api("io.coil-kt:coil:1.2.1") }