小编Dan*_*jer的帖子

无法找到 org.gradle.api.Project 类型的项目 ':app' 参数的方法 androidTestCompile()

今天我安装了 Android Studio,打开程序后,我在消息 Gradle 同步部分 -> 中看到此错误


Error:(31, 0) Could not find method androidTestCompile() for arguments [com.android.support.test.espresso:espresso-contrib:2.2.2, build_4zwzygftganlohhaghm2dsums$_run_closure3@7658f1d6] on project ':app' of type org.gradle.api.Project.
<a href="openFile:C:\Users\Dany\AndroidStudioProjects\MyApplication3\app\build.gradle">Open File</a>
Run Code Online (Sandbox Code Playgroud)

我的 gradle-module 中有这段代码 ->


apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.dany.myapplication"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.0', {
        exclude group: 'com.android.support', module: …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin

4
推荐指数
1
解决办法
9288
查看次数

标签 统计

android ×1

android-gradle-plugin ×1