Android Studio:找不到方法

时间:2019-01-21 11:40:17

标签: java android android-studio

我正在尝试在Android Studio中构建项目。我在早期版本的Android Studio上使用了它,但是在新环境中出现以下错误:

> ERROR: Could not find method androidTestImplementation() for arguments
> [com.android.support.test.espresso`:espresso`-core:2.2.2,
> build_10ngq9uijdpe3fhr06db8r1me$_run_closure3$_closure11@673c3997] on
> object of type
> org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Open File

这是build.gradle(module:app)的内容:

Build.gradle

我该如何解决?

2 个答案:

答案 0 :(得分:1)

您有一个错字。

此:

androidTestImplementation('', {
    exclude group: '', module: ''
})

应该是这样

androidTestImplementation('') {
    exclude group: '', module: ''
}

Gradle Reference

答案 1 :(得分:0)

您放错了括号/括号。

语法就像

androidTestImplementation("foo") { bar }

不喜欢

androidTestImplementation("foo", { bar })