我一直在寻找新架构组件的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

最佳答案

depsMap类的实例,该类在project实例上设置并在versions.gradle文件中定义。该versions.gradle文件又是根​​build.gradle脚本中的applied,因此deps可以在子项目中使用。

08-17 19:51