我正在关注this tutorial,以了解如何在我的Android应用程序中使用Kotlin管理Gradle依赖关系,现在我想在我的应用程序模块中使用在我的Versions对象中定义的版本(方案是我有一个开源屏幕,我想显示库版本)。我怎样才能做到这一点?
我尝试将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'.
而且网络上没有太多有关此错误的信息。
最佳答案
尝试从设置和build.gradle中删除buildSrc模块。它会自动构建并可供该项目中的所有其他模块访问。