2017-05-27 143 views
4

我想在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

作爲警告提示,該插件升級到2.3.2應該解決的問題:

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