dependencies {
// androidx
implementation("androidx.core:core-ktx:1.6.0")
// 感知组件生命周期
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1")
// activity 支持compose
implementation("androidx.activity:activity-compose:1.3.1")
// compose Modifier
implementation("androidx.compose.ui:ui:1.0.1")
// compose 组件
implementation("androidx.compose.material:material:1.0.1")
// compose 工具 预览
implementation("androidx.compose.ui:ui-tooling-preview:1.0.1")
// compose 工具
debugImplementation("androidx.compose.ui:ui-tooling:1.0.1")
// 本地 JVM 单元测试
testImplementation("junit:junit:4.13.2")
// Android 单元测试
androidTestImplementation("androidx.test.ext:junit:1.1.3")
// Android View 单元测试
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
// Android Compose 单元测试
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.0.1")
}
// 向上传递
api("")
debugApi()
releaseApi()
testApi()
// 自身使用
implementation()
debugImplementation()
releaseImplementation()
testImplementation()
// 仅参与编译,不参与打包
// android系统有这个API,但编译时需要引入才能构建通过
// 该指令实质:A module假装依赖了C module通过欺骗编译器编译时检测以避免java.lang.ClassNotFoundException编译报错
compileOnly("")
// 不参与编译,仅参与打包
runtimeOnly("")
通常开发的程序有2种模式:
Debug模式
Release模式
Test 单元测试
一些其他的依赖
// 调色版,从图片中提取颜色,让UI跟图片更搭配
implementation("androidx.palette:palette-ktx:${Versions.paletteKtx}")