Gradle测试编译错误

问题描述:

我想在Android Studio中构建一个项目项目。当我运行应用程序,我得到这个错误:Gradle测试编译错误

Error:(10, 0) Gradle DSL method not found: 'testCompile()' 
Possible causes: 
-The project 'AccurateCalculator' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). 
-Upgrade plugin to version 2.3.2 and sync project.The project 'AccurateCalculator' may be using a version of Gradle that does not contain the method. 
-Open Gradle wrapper file.The build file may be missing a Gradle plugin. Apply Gradle plugin 

项目build.grade具有下面的代码:

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

模块build.gradle具有下面的代码:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 17 
    buildToolsVersion "25.0.2" 

    defaultConfig { 
     applicationId "calculator.app" 
     minSdkVersion 14 
     targetSdkVersion 17 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 

dependencies { 
    compile 'com.android.support:support-v4:18.0.0' 
    compile files('libs/achartengine.jar') 
    compile files('libs/arity-2.1.6.jar') 
    compile files('libs/ejml-0.21.jar') 
    compile files('libs/slider.jar') 
} 

任何人都可以帮忙吗?

在此先感谢。

作为警告提示,该插件升级到2.3.2应该解决的问题:

classpath 'com.android.tools.build:gradle:2.3.2'