错误:找不到方法实现()

时间:2019-10-12 15:22:51

标签: java gradle implementation

这里是我们的代码:

dependencies {
    implementation project(path: ':openCVLibrary3')
    implementation project(path: ':DogeCV')
}
apply from: '../build.common.gradle'

它导致错误:

ERROR: Could not find method implementation() for arguments [DefaultProjectDependency{dependencyProject='project ':openCVLibrary3'', configuration='default'}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

谢谢!

1 个答案:

答案 0 :(得分:0)

implementation配置也是由java插件创建的。因此,您将必须应用该插件才能使用该配置。如果要从build.common.gradle构建文件中应用插件,请将引用该插件的行移到dependency块上方,以便在尝试使用插件提供的功能之前先应用插件。

如果您已经在执行此操作,则在使用旧版本的Gradle时也可能会发生。确保您使用的是Gradle 3.4或更高版本(或者必须使用compile)。