【发布时间】:2021-07-14 20:05:28
【问题描述】:
我刚开始学习 jetpack compose,我有几个问题
-
我应该使用“对 Gradle 构建文件使用 kotlin 脚本 (.kts)”吗?如果可以,有什么好处?
-
还有我如何跟上依赖关系
来自developers 的依赖项显示的是旧版本,然后是 android studio canary 中的那个。 其中一些要么根本不存在,要么版本不同
我需要包括这些
implementation 'androidx.compose.foundation:foundation:1.0.0-beta01'
implementation 'androidx.compose.material:material-icons-core:1.0.0-beta01'
implementation 'androidx.compose.material:material-icons-extended:1.0.0-beta01'
implementation 'androidx.compose.runtime:runtime-livedata:1.0.0-beta01'
implementation 'androidx.compose.runtime:runtime-rxjava2:1.0.0-beta01'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha02'
我需要包括那个吗
implementation 'androidx.compose.material:material:1.0.0-beta01'
或者被替换为
implementation 'com.google.android.material:material:1.3.0'
在哪里可以查看新版本以及是否兼容
implementation 'androidx.activity:activity-compose:1.3.0-alpha03'
implementation 'androidx.activity:activity-compose:1.3.0-alpha06
默认包含在 AS canary 中
dependencies {
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.0-alpha06'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
}
【问题讨论】:
标签: android-studio kotlin dependencies android-jetpack-compose gradle-kotlin-dsl