微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – Gradle testCompile错误

我正在尝试在Android Studio中构建项目项目.当我运行应用程序时,我收到此错误

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'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐