【问题标题】:Use buildSrc module versions in app module在 app 模块中使用 buildSrc 模块版本
【发布时间】:2019-11-17 16:16:04
【问题描述】:

我正在关注this tutorial,了解如何在我的 Android 应用程序中使用 Kotlin 管理 Gradle 依赖项,现在我想在我的 应用程序Versions 对象中使用定义的版本/em> 模块(场景是我有一个开源屏幕,我想显示库版本)。我该怎么做?

我已尝试将 buildSrc 目录添加到 settings.gradle

include ':app', ':buildSrc' 

然后在我的 build.gradle 文件中,将其添加到 dependencies 块中:

dependencies {
    implementation project(':buildSrc')
}

但是,当我尝试编译和运行时,会抛出以下错误:

Don't know how to compute maven coordinate for artifact 'Gradle API' with component identifier of type 'class org.gradle.internal.component.local.model.OpaqueComponentIdentifier'.

并且网络上没有太多关于此错误的信息。

【问题讨论】:

    标签: android gradle android-module


    【解决方案1】:

    尝试从您的设置和 build.gradle 中删除 buildSrc 模块。它自动构建并可供该项目中的所有其他模块访问。

    【讨论】:

    • 我的意思是,我也尝试过没有任何设置,并且在键入或自动完成时它不显示 Versions
    猜你喜欢
    • 2021-05-06
    • 2018-01-18
    • 2019-11-22
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 2019-05-19
    • 2015-12-22
    • 1970-01-01
    相关资源
    最近更新 更多