【发布时间】:2015-09-25 09:04:45
【问题描述】:
尝试在 Android-Studio 1.2 中我的 build.gradle 文件的末尾添加以下代码(如 this post 中所述):
test {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}
但是得到了:
Error:(40, 0) Gradle DSL method not found: 'test()'
Possible causes:
- The project 'xxxxx' may be using a version of Gradle that does not contain the method.
- The build file may be missing a Gradle plugin.
我错过了什么?
【问题讨论】:
-
是安卓的?不应该是
androidTest吗? -
@Opal,刚刚尝试使用
androidTest,但产生了相同的错误(除了test(),它是androidTest()) -
你应用插件了吗?听起来好像没有安装扩展程序。
-
@BenManes 哪个插件?我有
apply plugin: 'com.android.application'。我尝试添加apply plugin: 'java'和/或apply plugin: 'groovy',但这些显然与android 不兼容。 -
您能否发布一个显示此错误的最小完整构建文件?这将有助于我们调试。
标签: unit-testing android-studio gradle