Android 不支持的gradle方法instrumentTestCompile

Android 不支持的gradle方法instrumentTestCompile,android,android-studio,android-gradle-plugin,android-espresso,Android,Android Studio,Android Gradle Plugin,Android Espresso,在我的Android项目中包含espresso时,我有一个不受支持的gradle方法instrumentTestCompilegradle.build在Android studio上,按照谷歌的说明: gradle.build: dependencies { instrumentTestCompile files('libs/espresso-1.1.jar', 'libs/testrunner-1.1.jar', 'libs/testrunner-

在我的Android项目中包含espresso时,我有一个不受支持的gradle方法instrumentTestCompile
gradle.build
在Android studio上,按照谷歌的说明:

gradle.build:

dependencies {
  instrumentTestCompile files('libs/espresso-1.1.jar',
          'libs/testrunner-1.1.jar',
          'libs/testrunner-runtime-1.1.jar')

  instrumentTestCompile 'com.google.guava:guava:14.0.1',
          'com.squareup.dagger:dagger:1.1.0',
          'org.hamcrest:hamcrest-core:1.1',
          'org.hamcrest:hamcrest-integration:1.1',
          'org.hamcrest:hamcrest-library:1.1'
}
完全错误:

Build script error, unsupported Gradle DSL method found: ‘instrumentTestCompile()’!
Possible causes could be:
– you are using Gradle version where the method is absent
– you didn’t apply Gradle plugin which provides the method
– or there is a mistake in a build script

我在这里找到了答案:


在gradle插件的最新版本中,
instrumentTestCompile()
被重命名为
androidTestCompile()

我在这里找到了响应:


instrumentTestCompile()
已重命名为
androidTestCompile()
在最新版本的gradle插件中。

出于文档目的,因为在SO上找不到答案。这与testCompile有什么区别?回答如下:出于文档目的,因为在SO上找不到答案。这与testCompile有什么区别?回答如下: