我一直在寻找新架构组件的google示例,在其中找到了以下代码:
dependencies {
// Support libraries
implementation deps.support.app_compat
implementation deps.support.v4
implementation deps.support.design
implementation deps.support.cardview
// Architecture components
implementation deps.lifecycle.runtime
implementation deps.lifecycle.extensions
annotationProcessor deps.lifecycle.compiler
implementation deps.room.runtime
annotationProcessor deps.room.compiler
// Android Testing Support Library's runner and rules
androidTestImplementation deps.atsl.runner
androidTestImplementation deps.atsl.rules
androidTestImplementation deps.room.testing
androidTestImplementation deps.arch_core.testing
// Espresso UI Testing
androidTestImplementation deps.espresso.core
androidTestImplementation deps.espresso.contrib
androidTestImplementation deps.espresso.intents
// Resolve conflicts between main and test APK:
androidTestImplementation deps.support.annotations
androidTestImplementation deps.support.v4
androidTestImplementation deps.support.app_compat
androidTestImplementation deps.support.design
}
我不明白为什么他们要从
deps.*
开始编写所有依赖项。谁能帮助我理解代码。提前致谢。这是仓库的link。
最佳答案
deps
是Map
类的实例,该类在project
实例上设置并在versions.gradle文件中定义。该versions.gradle
文件又是根build.gradle
脚本中的applied,因此deps
可以在子项目中使用。